def parse(f, comment="#"):
    """
    Parse a file in ``.fasta`` format.

    :param f: Input file object
    :type f: _io.TextIOWrapper
    :param comment: Character used for comments
    :type comment: str

    :return: names, sequence
    :rtype: list[str], list[str]
    """
    starter = ">"
    empty = ""
    if "b" in f.mode:
        comment = b"#"
        starter = b">"
        empty = b""
    names = []
    sequences = []
    name = None
    sequence = []
    for line in f:
        if line.startswith(comment):
            continue
        line = line.strip()
        if line.startswith(starter):
            if name is not None:
                names.append(name)
                sequences.append(empty.join(sequence))
            name = line[1:]
            sequence = []
        else:
            sequence.append(line.upper())
    if name is not None:
        names.append(name)
        sequences.append(empty.join(sequence))

    return names, sequences