import re


def remove_extra_description_terms(description):
    """
    Sometimes the description contains some things we don't want to include
    like trailing '.', extra spaces, the string (non-protein coding) and a typo
    in the name of tmRNA's. This corrects those issues.
    """

    description = re.sub(
        r'\(\s*non\s*-\s*protein\s+coding\s*\)',
        '',
        description
    )
    description = re.sub(
        r'transfer-messenger mRNA',
        'transfer-messenger RNA',
        description,
        re.IGNORECASE
    )
    description = re.sub(r'\s\s+', ' ', description)
    description = re.sub(r'\.?\s*$', '', description)
    return description