import re


def parse_grant(grant):
    """Parse for grant number from grant annotation."""
    if len(grant):
        grant = re.sub(r'RO', 'R0', grant)
        grant_info = re.search(r"([A-Z][A-Z](\s|-)*\d{3,})[ /-]", grant, re.I)
        if grant_info is not None:
            grant_number = grant_info.group(1).upper()
            return re.sub(r'(\s|-)', '', grant_number)