Find signal or phase delay from cross correlation

I'm using python, but this is a generic question (more related to algorithms etc) and thus I skip some steps to get to the gist of the matter: I generate a sine signal like this: import math as m s...