docs: def AVP(avpId, **fields):
      """ Craft an AVP based on its id and optional parameter fields"""
      val = None
      classType = AVP_Unknown
      if isinstance(avpId, str):
          try:
              for vnd in AvpDefDict:
                  for code in AvpDefDict[vnd]:
                      val = AvpDefDict[vnd][code]
                      if val[0][:len(
                              avpId)] == avpId:  # A prefix of the full name is considered valid  # noqa: E501
                          raise
              found = False
          except BaseException:
              found = True
      else:
          if isinstance(avpId, list):
              code = avpId[0]
              vnd = avpId[1]
          else:  # Assume this is an int
              code = avpId
              vnd = 0
          try:
              val = AvpDefDict[vnd][code]
              found = True
          except BaseException:
              found = False
      if not found:
          warning('The AVP identifier %s has not been found.' % str(avpId))
          if isinstance(avpId, str):  # The string input is not valid
              return None
      # At this point code, vnd are provisionned val may be set (if found is True)  # noqa: E501
      # Set/override AVP code
      fields['avpCode'] = code
      # Set vendor if not already defined and relevant
      if 'avpVnd' not in fields and vnd:
          fields['avpVnd'] = vnd
      # Set flags if not already defined and possible ...
      if 'avpFlags' not in fields:
          if val:
              fields['avpFlags'] = val[2]
          else:
              fields['avpFlags'] = vnd and 128 or 0
      # Finally, set the name and class if possible
      if val:
          classType = val[1]
      _ret = classType(**fields)
      if val:
          _ret.name = 'AVP ' + val[0]
      return _ret