docs: def encodeSmsSubmitPdu(number, text, reference=0, validity=None, smsc=None, requestStatusReport=True, rejectDuplicates=False, sendFlash=False):
      """ Creates an SMS-SUBMIT PDU for sending a message with the specified text to the specified number
      
      :param number: the destination mobile number
      :type number: str
      :param text: the message text
      :type text: str
      :param reference: message reference number (see also: rejectDuplicates parameter)
      :type reference: int
      :param validity: message validity period (absolute or relative)
      :type validity: datetime.timedelta (relative) or datetime.datetime (absolute)
      :param smsc: SMSC number to use (leave None to use default)
      :type smsc: str
      :param rejectDuplicates: Flag that controls the TP-RD parameter (messages with same destination and reference may be rejected if True)
      :type rejectDuplicates: bool
              
      :return: A list of one or more tuples containing the SMS PDU (as a bytearray, and the length of the TPDU part
      :rtype: list of tuples
      """     
      tpduFirstOctet = 0x01 # SMS-SUBMIT PDU
      if validity != None:
          # Validity period format (TP-VPF) is stored in bits 4,3 of the first TPDU octet
          if type(validity) == timedelta:
              # Relative (TP-VP is integer)
              tpduFirstOctet |= 0x10 # bit4 == 1, bit3 == 0
              validityPeriod = [_encodeRelativeValidityPeriod(validity)]
          elif type(validity) == datetime:
              # Absolute (TP-VP is semi-octet encoded date)
              tpduFirstOctet |= 0x18 # bit4 == 1, bit3 == 1
              validityPeriod = _encodeTimestamp(validity) 
          else:
              raise TypeError('"validity" must be of type datetime.timedelta (for relative value) or datetime.datetime (for absolute value)')        
      else:
          validityPeriod = None
      if rejectDuplicates:
          tpduFirstOctet |= 0x04 # bit2 == 1
      if requestStatusReport:
          tpduFirstOctet |= 0x20 # bit5 == 1
      
      # Encode message text and set data coding scheme based on text contents
      try:
          encodedText = encodeGsm7(text)
      except ValueError:
          # Cannot encode text using GSM-7; use UCS2 instead
          alphabet = 0x08 # UCS2
      else:
          alphabet = 0x00 # GSM-7    
          
      # Check if message should be concatenated
      if len(text) > MAX_MESSAGE_LENGTH[alphabet]:
          # Text too long for single PDU - add "concatenation" User Data Header
          concatHeaderPrototype = Concatenation()
          concatHeaderPrototype.reference = reference
          pduCount = int(len(text) / MAX_MESSAGE_LENGTH[alphabet]) + 1
          concatHeaderPrototype.parts  = pduCount
          tpduFirstOctet |= 0x40
      else:
          concatHeaderPrototype = None
          pduCount = 1
      
      # Construct required PDU(s)
      pdus = []    
      for i in xrange(pduCount):
          pdu = bytearray()
          if smsc:
              pdu.extend(_encodeAddressField(smsc, smscField=True))
          else:
              pdu.append(0x00) # Don't supply an SMSC number - use the one configured in the device 
      
          udh = bytearray()
          if concatHeaderPrototype != None:
              concatHeader = copy(concatHeaderPrototype)
              concatHeader.number = i + 1
              if alphabet == 0x00:
                  pduText = text[i*153:(i+1) * 153]
              elif alphabet == 0x08:
                  pduText = text[i * 67 : (i + 1) * 67]
              udh.extend(concatHeader.encode())
          else:
              pduText = text
          
          udhLen = len(udh)        
          
          pdu.append(tpduFirstOctet)
          pdu.append(reference) # message reference
          # Add destination number    
          pdu.extend(_encodeAddressField(number))
          pdu.append(0x00) # Protocol identifier - no higher-level protocol
      
          pdu.append(alphabet if not sendFlash else (0x10 if alphabet == 0x00 else 0x18))
          if validityPeriod:
              pdu.extend(validityPeriod)
          
          if alphabet == 0x00: # GSM-7
              encodedText = encodeGsm7(pduText)
              userDataLength = len(encodedText) # Payload size in septets/characters
              if udhLen > 0:
                  shift = ((udhLen + 1) * 8) % 7 # "fill bits" needed to make the UDH end on a septet boundary
                  userData = packSeptets(encodedText, padBits=shift)
                  if shift > 0:
                      userDataLength += 1 # take padding bits into account
              else:
                  userData = packSeptets(encodedText)
          elif alphabet == 0x08: # UCS2
              userData = encodeUcs2(pduText)
              userDataLength = len(userData)
            
          if udhLen > 0:            
              userDataLength += udhLen + 1 # +1 for the UDH length indicator byte
              pdu.append(userDataLength)
              pdu.append(udhLen)
              pdu.extend(udh) # UDH
          else:
              pdu.append(userDataLength)
          pdu.extend(userData) # User Data (message payload)
          tpdu_length = len(pdu) - 1
          pdus.append(Pdu(pdu, tpdu_length))
      return pdus