docs: def committees(request, abbr):
      '''
      Context:
          chamber
          committees
          abbr
          metadata
          chamber_name
          chamber_select_template
          chamber_select_collection
          chamber_select_chambers
          committees_table_template
          show_chamber_column
          sort_order
          nav_active
  
      Templates:
          - billy/web/public/committees.html
          - billy/web/public/committees-pjax.html
          - billy/web/public/chamber_select_form.html
          - billy/web/public/committees_table.html
      '''
      try:
          meta = Metadata.get_object(abbr)
      except DoesNotExist:
          raise Http404
  
      chamber = request.GET.get('chamber', 'both')
      if chamber in ('upper', 'lower'):
          chamber_name = meta['chambers'][chamber]['name']
          spec = {'chamber': chamber}
          show_chamber_column = False
      elif chamber == 'joint':
          chamber_name = 'Joint'
          spec = {'chamber': 'joint'}
          show_chamber_column = False
      else:
          chamber = 'both'
          spec = {}
          show_chamber_column = True
          chamber_name = ''
  
      chambers = dict((k, v['name']) for k, v in meta['chambers'].items())
      if meta.committees({'chamber': 'joint'}).count():
          chambers['joint'] = 'Joint'
  
      fields = mongo_fields('committee', 'subcommittee', 'members',
                            settings.LEVEL_FIELD, 'chamber')
  
      sort_key = request.GET.get('key', 'committee')
      sort_order = int(request.GET.get('order', 1))
  
      committees = meta.committees_legislators(spec, fields=fields,
                                               sort=[(sort_key, sort_order)])
  
      sort_order = -sort_order
  
      return TemplateResponse(
          request, templatename('committees'),
          dict(chamber=chamber, committees=committees, abbr=abbr, metadata=meta,
               chamber_name=chamber_name,
               chamber_select_template=templatename('chamber_select_form'),
               chamber_select_collection='committees',
               chamber_select_chambers=chambers,
               committees_table_template=templatename('committees_table'),
               show_chamber_column=show_chamber_column, sort_order=sort_order,
               nav_active='committees'))