def edge_is_valid(edge):
    """
    >>> edge_is_valid([('source', 1), ('target', 1)])
    True
    >>> edge_is_valid([('source', 1)])
    False
    >>> edge_is_valid([('target', 1)])
    False
    """
    has_source = False
    has_target = False
    for key, _ in edge:
        if key == 'source':
            has_source = True
        if key == 'target':
            has_target = True
    return has_source and has_target
