code: def length(text, maxval=None, encoding=None):
      '''
      Count the length of a str the way Twitter does,
      double-counting "wide" characters (e.g. ideographs, emoji)
  
      Args:
          text (str): Text to count. Must be a unicode string in Python 2
          maxval (int): The maximum encoding that will be counted as 1 character.
              Defaults to 4351 (ჿ GEORGIAN LETTER LABIAL SIGN, U+10FF)
  
      Returns:
          int
      '''
      maxval = maxval or 4351
      try:
          assert not isinstance(text, six.binary_type)
      except AssertionError:
          raise TypeError('helpers.length requires a unicode argument')
      return sum(2 if ord(x) > maxval else 1 for x in unicodedata.normalize('NFC', text)f length(text, maxval=None, encoding=None):
      '''
      Count the length of a str the way Twitter does,
      double-counting "wide" characters (e.g. ideographs, emoji)
  
      Args:
          text (str): Text to count. Must be a unicode string in Python 2
          maxval (int): The maximum encoding that will be counted as 1 character.
              Defaults to 4351 (ჿ GEORGIAN LETTER LABIAL SIGN, U+10FF)
  
      Returns:
          int
      '''
      maxval = maxval or 4351
      try:
          assert not isinstance(text, six.binary_type)
      except AssertionError:
          raise TypeError('helpers.length requires a unicode argument')
      return sum(2 if ord(x) > maxval else 1 for x in unicodedata.normalize('NFC', text))
docs: Count the length of a str the way Twitter does,
      double-counting "wide" characters (e.g. ideographs, emoji)
  
      Args:
          text (str): Text to count. Must be a unicode string in Python 2
          maxval (int): The maximum encoding that will be counted as 1 character.
              Defaults to 4351 (ჿ GEORGIAN LETTER LABIAL SIGN, U+10FF)
  
      Returns:
          int