def find_your_legislator(request):
<EOL>get = request.GET<EOL>context = {}<EOL>template = '<STR_LIT>'<EOL>context['<STR_LIT>'] = "<STR_LIT>"<EOL>if "<STR_LIT:q>" in get:<EOL><INDENT>context['<STR_LIT>'] = get['<STR_LIT:q>']<EOL><DEDENT>if "<STR_LIT>" in get and "<STR_LIT>" in get:<EOL><INDENT>lat = get['<STR_LIT>']<EOL>lon = get['<STR_LIT>']<EOL>context['<STR_LIT>'] = lat<EOL>context['<STR_LIT>'] = lon<EOL>context['<STR_LIT>'] = True<EOL>qurl = "<STR_LIT>" % (<EOL>billy_settings.API_BASE_URL,<EOL>lon,<EOL>lat,<EOL>getattr(billy_settings, '<STR_LIT>', '<STR_LIT>')<EOL>)<EOL>leg_resp = json.load(urllib2.urlopen(qurl, timeout=<NUM_LIT:0.5>))<EOL>if '<STR_LIT>' in get:<EOL><INDENT>leg_resp = [leg for leg in leg_resp<EOL>if leg[billy_settings.LEVEL_FIELD] == get['<STR_LIT>']]<EOL>context['<STR_LIT>'] = get['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in get:<EOL><INDENT>leg_resp = [leg for leg in leg_resp<EOL>if leg['<STR_LIT>'] == get['<STR_LIT>']]<EOL>context['<STR_LIT>'] = get['<STR_LIT>']<EOL><DEDENT>if "<STR_LIT>" in get:<EOL><INDENT>return HttpResponse(json.dumps([]))<EOL><DEDENT>context['<STR_LIT>'] = map(Legislator, leg_resp)<EOL>template = '<STR_LIT>'<EOL><DEDENT>return render(request, templatename(template), context)<EOL>
Context:
    - request
    - lat
    - long
    - located
    - legislators

Templates:
    - billy/web/public/find_your_legislator_table.html