code: def key_to_int(key, base=BASE62):
      
      base_length = len(base)
  
      value = 0
      for c in reversed(key):
          value = (value * base_length) + base.index(c)
  
      return value
docs: Convert the following key to an integer.
  
      @param key: a key.
      @param base: a sequence of characters that was used to encode the
             integer value.
  
      @return: the integer value corresponding to the given key.
  
      @raise ValueError: if one character of the specified key doesn't match
             any character of the specified base.