code: def is_user_changing_own_key(self, req, user):
          
          admin_detail = self.get_admin_detail(req)
          if not admin_detail:
              # The user does not exist
              return False
  
          # If user is not admin/reseller_admin and x-auth-user-admin or
          # x-auth-user-reseller-admin headers are present in request, he may be
          # attempting to escalate himself as admin/reseller_admin!
          if '.admin' not in (g['name'] for g in admin_detail['groups']):
              if req.headers.get('x-auth-user-admin') == 'true' or \
                      req.headers.get('x-auth-user-reseller-admin') == 'true':
                          return False
          if '.reseller_admin' not in \
              (g['name'] for g in admin_detail['groups']) and \
                  req.headers.get('x-auth-user-reseller-admin') == 'true':
                      return False
  
          return req.headers.get('x-auth-admin-user') == user and \
              self.credentials_match(admin_detail,
                                     req.headers.get('x-auth-admin-key'))
docs: Check if the user is changing his own key.
  
          :param req: The swob.Request to check. This contains x-auth-admin-user
                      and x-auth-admin-key headers which are credentials of the
                      user sending the request.
          :param user: User whose password is to be changed.
          :returns: True if user is changing his own key, False if not.