def is_head_line(line, require_source_at_end=False, require_all_meta=False):
    """Check whether a line is a source document separator."""
    if require_source_at_end and not line.rstrip().endswith('></source>'):
        return False
    if require_all_meta:
        return line.startswith('<source><') and '</source>' in line and (
            '<date>' in line or '<datum>' in line) and ('<location>' in
            line or '<name_lang>' in line)
    return line.startswith('<source><')
