code: def get_lights(self):
          '''
          Lists all available lights on the bridge.
          '''
          url = '/api/%s/lights' % self.username
          response = self.make_request('GET', url)
          lights = []
          # Did we get a success response back?
          # error responses look like:
          # [{'error': {'address': '/lights',
          #    'description': 'unauthorized user',
          #    'type': 1}}]
  
          if 'error' in response:
              raise Exception(response['error']['description'])
  
          for id_, data in response.items():
              lights.append(Light(
                  id_,
                  data['modelid'],
                  data['name'],
                  data['state'],
                  data['swversion'],
                  data['type'],
                  data['uniqueid']
              ))
  
          lights = sorted(lights, key=lambda x: x.light_id)
          self._lights = lights
          return lightf get_lights(self):
          '''
          Lists all available lights on the bridge.
          '''
          url = '/api/%s/lights' % self.username
          response = self.make_request('GET', url)
          lights = []
          # Did we get a success response back?
          # error responses look like:
          # [{'error': {'address': '/lights',
          #    'description': 'unauthorized user',
          #    'type': 1}}]
  
          if 'error' in response:
              raise Exception(response['error']['description'])
  
          for id_, data in response.items():
              lights.append(Light(
                  id_,
                  data['modelid'],
                  data['name'],
                  data['state'],
                  data['swversion'],
                  data['type'],
                  data['uniqueid']
              ))
  
          lights = sorted(lights, key=lambda x: x.light_id)
          self._lights = lights
          return lights
docs: Lists all available lights on the bridge.