def query_admin2s(admin1: Optional[str]=None, admin1_id: Optional[str]=None, admin2s: List[str]=[], admin2_ids: List[str]=[]) -> List[Region]:
    '\n    Returns a list of admin2s. If admin1 or admin1_id is specified, return the admin2s only of that admin1.\n    If admin2s or admin2_ids are provided, only those admins are returned.\n    If all arguments are empty, all admin2s in the system are returned.\n    '
    if (admin1 and admin1_id):
        raise ValueError('Only one of admin1, admin1_id may be specified')
    if admin1_id:
        admin1_where = f"e_admin1.node2='{admin1_id}'"
    elif admin1:
        admin1_where = f"LOWER(s_admin1_label.text)=LOWER('{admin1}')"
    else:
        admin1_where = '1=1'
    admin2_where = region_where_clause('s_admin2_label.text', admin2s, 'e_admin2.node1', admin2_ids)
    query = f'''
    SELECT  e_admin2.node1 AS admin_id,
            s_admin2_label.text AS admin,
            'Q13220204' AS region_type,
            e_country.node2 AS country_id,
            s_country_label.text AS country,
            e_admin1.node2 AS admin1_id,
            s_admin1_label.text AS admin1,
            e_admin2.node1 AS admin2_id,
            s_admin2_label.text AS admin2,
            NULL as admin3_id,
            NULL as admin3
    FROM edges e_admin2
        JOIN edges e_admin2_label JOIN strings s_admin2_label ON (e_admin2_label.id=s_admin2_label.edge_id)
            ON (e_admin2.node1=e_admin2_label.node1 AND e_admin2_label.label='label')
        JOIN edges e_admin1 ON (e_admin1.node1=e_admin2.node1 AND e_admin1.label='P2006190001')
        JOIN edges e_admin1_label JOIN strings s_admin1_label ON (e_admin1_label.id=s_admin1_label.edge_id)
            ON (e_admin1.node2=e_admin1_label.node1 AND e_admin1_label.label='label')
        JOIN edges e_country ON (e_country.node1=e_admin1.node2 AND e_country.label='P17')
        JOIN edges e_country_label JOIN strings s_country_label ON (e_country_label.id=s_country_label.edge_id)
            ON (e_country.node2=e_country_label.node1 AND e_country_label.label='label')
    WHERE e_admin2.label='P31' AND e_admin2.node2='Q13220204' AND {admin1_where} AND {admin2_where}
    ORDER BY admin2
    '''
    return _query_regions(query)
Returns a list of admin2s. If admin1 or admin1_id is specified, return the admin2s only of that admin1.
If admin2s or admin2_ids are provided, only those admins are returned.
If all arguments are empty, all admin2s in the system are returned.
def query_admin2s(admin1: Optional[str]=None, admin1_id: Optional[str]=None, admin2s: List[str]=[], admin2_ids: List[str]=[]) -> List[Region]:
    '\n    Returns a list of admin2s. If admin1 or admin1_id is specified, return the admin2s only of that admin1.\n    If admin2s or admin2_ids are provided, only those admins are returned.\n    If all arguments are empty, all admin2s in the system are returned.\n    '
    if (admin1 and admin1_id):
        raise ValueError('Only one of admin1, admin1_id may be specified')
    if admin1_id:
        admin1_where = f"e_admin1.node2='{admin1_id}'"
    elif admin1:
        admin1_where = f"LOWER(s_admin1_label.text)=LOWER('{admin1}')"
    else:
        admin1_where = '1=1'
    admin2_where = region_where_clause('s_admin2_label.text', admin2s, 'e_admin2.node1', admin2_ids)
    query = f'
    SELECT  e_admin2.node1 AS admin_id,
            s_admin2_label.text AS admin,
            'Q13220204' AS region_type,
            e_country.node2 AS country_id,
            s_country_label.text AS country,
            e_admin1.node2 AS admin1_id,
            s_admin1_label.text AS admin1,
            e_admin2.node1 AS admin2_id,
            s_admin2_label.text AS admin2,
            NULL as admin3_id,
            NULL as admin3
    FROM edges e_admin2
        JOIN edges e_admin2_label JOIN strings s_admin2_label ON (e_admin2_label.id=s_admin2_label.edge_id)
            ON (e_admin2.node1=e_admin2_label.node1 AND e_admin2_label.label='label')
        JOIN edges e_admin1 ON (e_admin1.node1=e_admin2.node1 AND e_admin1.label='P2006190001')
        JOIN edges e_admin1_label JOIN strings s_admin1_label ON (e_admin1_label.id=s_admin1_label.edge_id)
            ON (e_admin1.node2=e_admin1_label.node1 AND e_admin1_label.label='label')
        JOIN edges e_country ON (e_country.node1=e_admin1.node2 AND e_country.label='P17')
        JOIN edges e_country_label JOIN strings s_country_label ON (e_country_label.id=s_country_label.edge_id)
            ON (e_country.node2=e_country_label.node1 AND e_country_label.label='label')
    WHERE e_admin2.label='P31' AND e_admin2.node2='Q13220204' AND {admin1_where} AND {admin2_where}
    ORDER BY admin2
    '
    return _query_regions(query)