import re


def reformat_accession(seq_record):
    """
    Reformat accessions in Seq object to be <=20 chars long and not contain any special chars
    """
    if len(seq_record.id) > 20:
        short_id = seq_record.id[:20]
    else:
        short_id = seq_record.id

    seq_record.id = re.sub('[|,/,\,.,:,\,),(]', '_', short_id)
    return seq_record