def _mobius(p, q):
    """ Applies the mobius transformation that fixes the line from q to the origin
    and sends q to the origin to the point p.

    Parameters
    ----------
    p : list of floats, length 2
        The coordinate we are applying this transformation to.
    q : list of floats, length 2
        The coordinate that gets sent to the origin by this map.

    Returns
    -------
    list of floats, length 2
        The transformed coordinate p after applying the transformation that moves q to the
        origin.
    """
    # pylint:disable=invalid-name
    # pure math formula
    u, v = p
    a, b = q
    return [-1 * ((u-a)*(a*u+b*v-1)+(v-b)*(a*v-b*u))/((a*u+b*v-1)**2+(a*v-b*u)**2),
            -1 * ((v-b)*(a*u+b*v-1)-(u-a)*(a*v-b*u))/((a*u+b*v-1)**2+(a*v-b*u)**2)]