def clean_input_sequence(fasta_handle):
    """
    This function will take in a data handle containing the contents of the input file and will return a cleaned
    sequence containing just nucleotide residues with no header or whitespace

    :param fasta_handle: data handle containing a nucleotide sequence, optionally with a header, line breaks are allowable
    :return: a string of nucleotide residues
    """

    # Read in fasta handle line by line, stripping whitespace and discarding any header line
    nt_sequence = ""
    for line in fasta_handle:
        line = line.strip()
        if line.startswith(">"):
            continue
        nt_sequence = nt_sequence + line

    return nt_sequence