In Python 2.6 and higher, math.copysign(x, y) returns x with the sign of y. The returned value is always a float.
Python 2.x2.6
math.copysign(-2, 3) # 2.0
math.copysign(3, -3) # -3.0
math.copysign(4, 14.2) # 4.0
math.copysign(1, -0.0) # -1.0, on a platform which supports signed zero
...