code: def charset_to_int(s, charset):
      
      output = 0
      for char in s:
          output = output * len(charset) + charset.index(char)
  
      return output
docs: Turn a string into a non-negative integer.
  
      >>> charset_to_int('0', B40_CHARS)
      0
      >>> charset_to_int('10', B40_CHARS)
      40
      >>> charset_to_int('abcd', B40_CHARS)
      658093
      >>> charset_to_int('', B40_CHARS)
      0
      >>> charset_to_int('muneeb.id', B40_CHARS)
      149190078205533
      >>> charset_to_int('A', B40_CHARS)
      Traceback (most recent call last):
          ...
      ValueError: substring not found