code: def scope(cls, f):
          
          if not hasattr(cls, "scopes"):
              cls.scopes = copy(STANDARD_SCOPES)
  
          cls.scopes.append(f)
  
          def create_builder(self, *args, **kwargs):
              bldr = ScopeBuilder(cls, cls.scopes)
              return getattr(bldr, f.__name__)(*args, **kwargs)
  
          setattr(cls, f.__name__, classmethod(create_builder))
          return f
docs: Decorator which can dynamically attach a query scope to the model.