def transpose(matrix):
    """Returns the transpose for the given matrix"""
    if not matrix:
        return []
    elif matrix[0] and not isinstance(matrix[0], list):
        return [[elem] for elem in matrix]
    return list(map(list, zip(*matrix)))