import math


def rotate_coordinate(x, y, cx, cy, theta):
    """Return a new point (x', y') as rotating an existing point
    (x, y) theta radians around the point (cx, cy).
    """
    x_p = ((x - cx) * math.cos(theta) + (y - cy) * math.sin(theta)) + cx
    y_p = (-(x - cx) * math.sin(theta) + (y - cy) * math.cos(theta)) + cy
    return x_p, y_p