code: def _decodeUserData(byteIter, userDataLen, dataCoding, udhPresent):
      
      result = {}
      if udhPresent:
          # User Data Header is present
          result['udh'] = []
          udhLen = next(byteIter)
          ieLenRead = 0
          # Parse and store UDH fields
          while ieLenRead < udhLen:
              ie = InformationElement.decode(byteIter)
              ieLenRead += len(ie)
              result['udh'].append(ie)
          del ieLenRead
          if dataCoding == 0x00: # GSM-7
              # Since we are using 7-bit data, "fill bits" may have been added to make the UDH end on a septet boundary
              shift = ((udhLen + 1) * 8) % 7 # "fill bits" needed to make the UDH end on a septet boundary
              # Simulate another "shift" in the unpackSeptets algorithm in order to ignore the fill bits
              prevOctet = next(byteIter)
              shift += 1
  
      if dataCoding == 0x00: # GSM-7
          if udhPresent:
              userDataSeptets = unpackSeptets(byteIter, userDataLen, prevOctet, shift)
          else:
              userDataSeptets = unpackSeptets(byteIter, userDataLen)
          result['text'] = decodeGsm7(userDataSeptets)
      elif dataCoding == 0x02: # UCS2
          result['text'] = decodeUcs2(byteIter, userDataLen)
      else: # 8-bit (data)
          userData = []
          for b in byteIter:
              userData.append(unichr(b))
          result['text'] = ''.join(userData)
      return result
docs: Decodes PDU user data (UDHI (if present) and message text)