code: def get_sh_identity(self, item, identity_field=None):
          
  
          def fill_list_identity(identity, user_list_data):
              """ Fill identity with user data in first item in list """
              identity['username'] = user_list_data[0]['__text__']
              if '@' in identity['username']:
                  identity['email'] = identity['username']
              if 'name' in user_list_data[0]:
                  identity['name'] = user_list_data[0]['name']
              return identity
  
          identity = {}
          for field in ['name', 'email', 'username']:
              # Basic fields in Sorting Hat
              identity[field] = None
  
          user = item  # by default a specific user dict is used
          if 'data' in item and type(item) == dict:
              user = item['data'][identity_field]
  
          identity = fill_list_identity(identity, user)
  
          return identity
docs: Return a Sorting Hat identity using bugzilla user data