def query(id):
    for line in file:
        table = {}
table['ID'], table['name'], table['city'] = line.split(';')
if id == int(table['ID']):
    file.close()
return table
file.close()
return {}
How to return a dictionary | Python