code: def pad(text, length):
      
      text_length = wcswidth(text)
  
      if text_length < length:
          return text + ' ' * (length - text_length)
  
      return text
docs: Pads text to given length, taking into account wide characters.