code: def handle_security(controller, im_self=None):
      
      if controller._pecan.get('secured', False):
          check_permissions = controller._pecan['check_permissions']
  
          if isinstance(check_permissions, six.string_types):
              check_permissions = getattr(
                  im_self or six.get_method_self(controller),
                  check_permissions
              )
  
          if not check_permissions():
              raise exc.HTTPUnauthorized
docs: Checks the security of a controller.