code: def random_string(length=8, charset=None):
      '''
      Generates a string with random characters. If no charset is specified, only
      letters and digits are used.
  
      Args:
          length (int) length of the returned string
          charset (string) list of characters to choose from
      Returns:
          (str) with random characters from charset
      Raises:
          -
      '''
      if length < 1:
          raise ValueError('Length must be > 0')
      if not charset:
          charset = string.letters + string.digits
      return ''.join(random.choice(charset) for unused in xrange(length)f random_string(length=8, charset=None):
      '''
      Generates a string with random characters. If no charset is specified, only
      letters and digits are used.
  
      Args:
          length (int) length of the returned string
          charset (string) list of characters to choose from
      Returns:
          (str) with random characters from charset
      Raises:
          -
      '''
      if length < 1:
          raise ValueError('Length must be > 0')
      if not charset:
          charset = string.letters + string.digits
      return ''.join(random.choice(charset) for unused in xrange(length))
docs: Generates a string with random characters. If no charset is specified, only
      letters and digits are used.
  
      Args:
          length (int) length of the returned string
          charset (string) list of characters to choose from
      Returns:
          (str) with random characters from charset
      Raises:
          -