code: def filter_by_id(self, query):
          
          if self.model is None:
              raise ArrestedException('DBObjectMixin requires a model to be set.')
  
          idfield = getattr(self.model, self.model_id_param, None)
          if not idfield:
              raise ArrestedException('DBObjectMixin could not find a valid Model.id.')
  
          return query.filter(idfield == self.kwargs[self.url_id_param])
docs: Apply the primary key filter to query to filter the results for a specific
          instance by id.
  
          The filter applied by the this method by default can be controlled using the
          url_id_param
  
          :param query: SQLAlchemy Query
          :returns: A SQLAlchemy Query object