<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def charset_to_int(s, charset):
 """ Turn a string into a non-negative integer. 0 40 658093 0 149190078205533 Traceback (most recent call last):
 ValueError: substring not found """

    output = 0
    for char in s:
        output = output * len(charset) + charset.index(char)

    return output