def to_decimal(text):
if not isinstance(text, string_type):<EOL><INDENT>raise TypeError("<STR_LIT>" % type(text))<EOL><DEDENT>if findall(r"<STR_LIT>", text):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>text = text.lstrip('<STR_LIT:!>')<EOL>decimal = <NUM_LIT:0><EOL>length = len(text) - <NUM_LIT:1><EOL>for i, char in enumerate(text):<EOL><INDENT>decimal += (ord(char) - <NUM_LIT>) * (<NUM_LIT> ** (length - i))<EOL><DEDENT>return decimal if text != '<STR_LIT>' else <NUM_LIT:0><EOL>
Takes a base91 char string and returns decimal