code: def predicate(fn=None, name=None, **options):
      
      if not name and not callable(fn):
          name = fn
          fn = None
  
      def inner(fn):
          if isinstance(fn, Predicate):
              return fn
          p = Predicate(fn, name, **options)
          update_wrapper(p, fn)
          return p
  
      if fn:
          return inner(fn)
      else:
          return inner
docs: Decorator that constructs a ``Predicate`` instance from any function::
  
          >>> @predicate
          ... def is_book_author(user, book):
          ...     return user == book.author
          ...
  
          >>> @predicate(bind=True)
          ... def is_book_author(self, user, book):
          ...     if self.context.args:
          ...         return user == book.author