def cross(v1, v2):
    """Cross product of two vectors"""
    n = len(v1)
    prod = n*[0]
    if n == 3 and len(v2) == 3:
        prod[0] = v1[1]*v2[2] - v1[2]*v2[1]
        prod[1] = v1[2]*v2[0] - v1[0]*v2[2]
        prod[2] = v1[0]*v2[1] - v1[1]*v2[0]
    return prod