def check_record(record):
    """Correct missing arxiv: prefix."""
    try:
        primary_report_number = record['primary_report_number']
    except KeyError:
        pass
    else:
        if is_arxiv_id(primary_report_number):
            if not primary_report_number.startswith(arxiv_prefix):
                primary_report_number = arxiv_prefix + primary_report_number
                record['primary_report_number'] = primary_report_number
    return record
def check_record(record):
    """Correct missing arxiv: prefix."""
    try:
        primary_report_number = record['primary_report_number']
    except KeyError:
        pass
    else:
        if is_arxiv_id(primary_report_number):
            if not primary_report_number.startswith(arxiv_prefix):
                primary_report_number = arxiv_prefix + primary_report_number
                record['primary_report_number'] = primary_report_number
    return record
def _get_arxiv_id_from_record(record):
    """
    :raises: KeyError
    """
    try:
        primary_report_number = record['primary_report_number']
    except KeyError:
        return None
    else:
        if is_arxiv_id(primary_report_number):
            arxiv_id = re.sub('^arXiv:', '', primary_report_number)
            return arxiv_id
        else:
            return None
def _get_arxiv_id_from_record(record):
    """
    :raises: KeyError
    """
    try:
        primary_report_number = record['primary_report_number']
    except KeyError:
        return None
    else:
        if is_arxiv_id(primary_report_number):
            arxiv_id = re.sub('^arXiv:', '', primary_report_number)
            return arxiv_id
        else:
            return None