code: def random_chars(number):
      
      char_map = {
          k: v for k, v in chars.CHARS.iteritems()
          if not format_character(k).startswith('\\x')
      }
  
      char_num = sum(char_map.values())
      return (
          format_character(nth_char(char_map, random.randint(0, char_num - 1)))
          for _ in xrange(0, number)
      )
docs: Generate random characters