def region_filter(annos, annotation):
    """filter for Region annotations.
    The 'time' parameter can match either 'time' or 'timeEnd' parameters.
    """
    result = []
    for anno in annos:
        time = annotation.get("time")
        timeEnd = annotation.get("timeEnd")
        for key in ['text', 'tags']:
            if anno.get(key) != annotation.get(key):
                continue
        if anno.get("regionId") == 0:
            continue
        if anno.get("time") not in [time, timeEnd]:
            continue
        result.append(anno)
    return result