code: def has_role(user, *roles, **kwargs):
      
      Role = get_model('role')
      if isinstance(user, (unicode, str)):
          User = get_model('user')
          user = User.get(User.c.username==user)
          
      for role in roles:
          if isinstance(role, (str, unicode)):
              role = Role.get(Role.c.name==role)
              if not role:
                  continue
          name = role.name
          
          func = __role_funcs__.get(name, None)
          if func:
              if isinstance(func, (unicode, str)):
                  func = import_attr(func)
                  
              assert callable(func)
              
              para = kwargs.copy()
              para['user'] = user
              flag = call_func(func, para)
              if flag:
                  return role
          flag = role.users.has(user)
          if flag:
              return role
          
          flag = role.usergroups_has_user(user)
          if flag:
              return role
      return False
docs: Judge is the user belongs to the role, and if does, then return the role object
      if not then return False. kwargs will be passed to role_func.