def CalculateDataLength(data):
 if isinstance(data, str):
  return len(data)
 elif isinstance(data, list):
  return None
 elif ElementTree.iselement(data):
  return len(ElementTree.tostring(data))
 elif hasattr(data, 'read'):
  return None
 else:
  return len(str(data))

def CalculateDataLength ( data ) : if isinstance ( data , str ) : return len ( data ) elif isinstance ( data , list ) : return None elif ElementTree . iselement ( data ) : return len ( ElementTree . tostring ( data ) ) elif hasattr ( data , 'read' ) : return None else : return len ( str ( data ) )
attempts to determine the length of the data to send .