code: def update_instance(self, data):
          
          for key, val in iteritems(data):
              if not hasattr(self, key):
                  raise AttributeError(
                      "No field named {key} for model {model}".format(
                          key=key,
                          model=self.__class__.__name__
                      )
                  )
  
              setattr(self, key, val)
  
          self.save()
  
          return self
docs: Update a single record by id with the provided data.
  
          Args:
              data (dict): The new data to update the record with.
  
          Returns:
              self: This is an instance of itself with the updated data.
  
          Raises:
              AttributeError: This is raised if a key in the ``data`` isn't
                  a field on the model.