docs: def getCmdParams(cmd, request, **fields):
      """Update or fill the fields parameters depending on command code. Both cmd and drAppId can be provided  # noqa: E501
         in string or int format."""
      drCode = None
      params = None
      drAppId = None
      # Fetch the parameters if cmd is found in dict
      if isinstance(cmd, int):
          drCode = cmd    # Enable to craft commands with non standard code
          if cmd in DR_cmd_def:
              params = DR_cmd_def[drCode]
          else:
              params = ('Unknown', 'UK', {0: (128, 0)})
              warning(
                  'No Diameter command with code %d found in DR_cmd_def dictionary' %  # noqa: E501
                  cmd)
      else:  # Assume command is a string
          if len(cmd) > 3:     # Assume full command name given
              fpos = 0
          else:         # Assume abbreviated name is given and take only the first two letters  # noqa: E501
              cmd = cmd[:2]
              fpos = 1
          for k, f in DR_cmd_def.items():
              if f[fpos][:len(
                      cmd)] == cmd:   # Accept only a prefix of the full name
                  drCode = k
                  params = f
                  break
          if not drCode:
              warning(
                  'Diameter command with name %s not found in DR_cmd_def dictionary.' %  # noqa: E501
                  cmd)
              return (fields, 'Unknown')
      # The drCode is set/overridden in any case
      fields['drCode'] = drCode
      # Processing of drAppId
      if 'drAppId' in fields:
          val = fields['drAppId']
          if isinstance(val, str):   # Translate into application Id code
              found = False
              for k, v in six.iteritems(AppIDsEnum):
                  if v.find(val) != -1:
                      drAppId = k
                      fields['drAppId'] = drAppId
                      found = True
                      break
              if not found:
                  del(fields['drAppId'])
                  warning(
                      'Application ID with name %s not found in AppIDsEnum dictionary.' %  # noqa: E501
                      val)
                  return (fields, 'Unknown')
          else:   # Assume type is int
              drAppId = val
      else:  # Application Id shall be taken from the params found based on cmd
          drAppId = next(iter(params[2]))   # The first record is taken
          fields['drAppId'] = drAppId
      # Set the command name
      name = request and params[0] + '-Request' or params[0] + '-Answer'
      # Processing of flags (only if not provided manually)
      if 'drFlags' not in fields:
          if drAppId in params[2]:
              flags = params[2][drAppId]
              fields['drFlags'] = request and flags[0] or flags[1]
      return (fields, name)