code: def has_role(self, role):
          
          if isinstance(role, string_types):
              return role in (role.name for role in self.roles)
          else:
              return role in self.roles
docs: Returns `True` if the user identifies with the specified role.
  
          :param role: A role name or `Role` instance