def refine(string, variables=[]):
    """refine(...) --> str

	Return a parsed math term mostly readable by python
	eg.  .25 -> 0.25 ,  2x(54/3) -> 2*x*(54/3) ,
	 | 1-x^3 \\|/{10-4} -> (abs (1-x**3) )/(10-4)  etc.
	second parameter is a list of single character
	reserved as unknown values
	Not fully reliable
	Will be changed in future versions"""
    string = string.replace(' ', '')
    string = string.replace('^', '**')
    string = string.replace('[', '(')
    string = string.replace(']', ')')
    string = string.replace('{', '(')
    string = string.replace('}', ')')
    string = string.replace('\\|', ') )')
    string = string.replace('|', '(abs (')
    last_index = -1
    for _ in range(string.count('.')):
        index = string.index('.', last_index + 1)
        if index != 0:
            if not string[index - 1].isdigit():
                string = string[:index] + '0.' + string[index + 1:]
        else:
            string = '0' + string
        last_index = index
    last_index = -1
    for _ in range(string.count('(')):
        index = string.index('(', last_index + 1)
        if index != 0 and (string[index - 1].isdigit() or string[index - 1] in
            variables):
            string = string[:index] + '*(' + string[index + 1:]
        last_index = index
    last_index = -1
    for _ in range(string.count(')')):
        length = len(string)
        index = string.index(')', last_index + 1)
        if index + 1 < length:
            if string[index + 1].isdigit() or string[index + 1
                ] in variables + ['(']:
                string = string[:index] + ')*' + string[index + 1:]
        last_index = index
    for v in variables:
        last_index = -1
        for _ in range(string.count(v)):
            index = string.index(v, last_index + 1)
            if index != 0 and string[index - 1] not in '+-*/%()':
                string = string[:index] + '*' + v + string[index + 1:]
            if index + 1 < len(string):
                if string[index + 1] not in '+-*/%()' + v:
                    string = string[:index] + v + '*' + string[index + 1:]
    return string
