def cartezian(*vectors):
    """Compute Cartesian product of passed arguments
    """
    ret = ret_old = [(v,) for v in vectors[0]]
    for vec in vectors[1:]:
        ret = []
        for v in vec:
            for r in ret_old:
                ret.append(r+(v,))
        ret_old = ret
    return ret