code: def credentials_match(self, user_detail, key):
          
          if user_detail:
              creds = user_detail.get('auth')
              try:
                  auth_encoder, creds_dict = \
                      swauth.authtypes.validate_creds(creds)
              except ValueError as e:
                  self.logger.error('%s' % e.args[0])
                  return False
          return user_detail and auth_encoder.match(key, creds, **creds_dict)
docs: Returns True if the key is valid for the user_detail.
          It will use auth_encoder type the password was encoded with,
          to check for a key match.
  
          :param user_detail: The dict for the user.
          :param key: The key to validate for the user.
          :returns: True if the key is valid for the user, False if not.