def parse_annotation(obj: dict) -> BioCAnnotation:
    """Deserialize a dict obj to a BioCAnnotation object"""
    ann = BioCAnnotation()
    ann.id = obj['id']
    ann.infons = obj['infons']
    ann.text = obj['text']
    for loc in obj['locations']:
        ann.add_location(BioCLocation(loc['offset'], loc['length']))
    return ann