def query_admin1s(country: Optional[str]=None, country_id: Optional[str]=None, admin1s: List[str]=[], admin1_ids: List[str]=[]) -> List[Region]:
    '\n    Returns a list of admin1s. If country or country_id is specified, return the admin1s only of that country.\n    If admin1s or admin1_ids are provided, only those admins are returned.\n    If all arguments are empty, all admin1s in the system are returned.\n    '
    if (country and country_id):
        raise ValueError('Only one of country, country_id may be specified')
    if country_id:
        country_where = f"e_country.node2='{country_id}'"
    elif country:
        country_where = f"LOWER(s_country_label.text)='{country.lower()}'"
    else:
        country_where = '1=1'
    admin1_where = region_where_clause('s_admin1_label.text', admin1s, 'e_admin1.node1', admin1_ids)
    query = f'''
    SELECT  e_admin1.node1 AS admin_id,
            s_admin1_label.text AS admin,
            'Q10864048' AS region_type,
            e_country.node2 AS country_id,
            s_country_label.text AS country,
            e_admin1.node1 as admin1_id,
            s_admin1_label.text as admin1,
            NULL as admin2_id,
            NULL as admin2,
            NULL as admin3_id,
            NULL as admin3
    FROM edges e_admin1
        JOIN edges e_admin1_label JOIN strings s_admin1_label ON (e_admin1_label.id=s_admin1_label.edge_id)
            ON (e_admin1.node1=e_admin1_label.node1 AND e_admin1_label.label='label')
        JOIN edges e_country ON (e_country.node1=e_admin1.node1 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_admin1.label='P31' AND e_admin1.node2='Q10864048' AND {country_where} AND {admin1_where}
    ORDER BY admin1
    '''
    return _query_regions(query)
Returns a list of admin1s. If country or country_id is specified, return the admin1s only of that country.
If admin1s or admin1_ids are provided, only those admins are returned.
If all arguments are empty, all admin1s in the system are returned.
def query_admin1s(country: Optional[str]=None, country_id: Optional[str]=None, admin1s: List[str]=[], admin1_ids: List[str]=[]) -> List[Region]:
    '\n    Returns a list of admin1s. If country or country_id is specified, return the admin1s only of that country.\n    If admin1s or admin1_ids are provided, only those admins are returned.\n    If all arguments are empty, all admin1s in the system are returned.\n    '
    if (country and country_id):
        raise ValueError('Only one of country, country_id may be specified')
    if country_id:
        country_where = f"e_country.node2='{country_id}'"
    elif country:
        country_where = f"LOWER(s_country_label.text)='{country.lower()}'"
    else:
        country_where = '1=1'
    admin1_where = region_where_clause('s_admin1_label.text', admin1s, 'e_admin1.node1', admin1_ids)
    query = f'
    SELECT  e_admin1.node1 AS admin_id,
            s_admin1_label.text AS admin,
            'Q10864048' AS region_type,
            e_country.node2 AS country_id,
            s_country_label.text AS country,
            e_admin1.node1 as admin1_id,
            s_admin1_label.text as admin1,
            NULL as admin2_id,
            NULL as admin2,
            NULL as admin3_id,
            NULL as admin3
    FROM edges e_admin1
        JOIN edges e_admin1_label JOIN strings s_admin1_label ON (e_admin1_label.id=s_admin1_label.edge_id)
            ON (e_admin1.node1=e_admin1_label.node1 AND e_admin1_label.label='label')
        JOIN edges e_country ON (e_country.node1=e_admin1.node1 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_admin1.label='P31' AND e_admin1.node2='Q10864048' AND {country_where} AND {admin1_where}
    ORDER BY admin1
    '
    return _query_regions(query)