def unit(v, lg=1):
    """ unit vector
    Args:
        v: vector (x, y)
        lg: length
    Raises:
        ValueError: Null vector was given
    """
    try:
        res = scale(v, lg / distance((0, 0), v))
    except ZeroDivisionError:
        raise ValueError("Null vector was given")
    return res