def cast(func, value):
if value is not None:<EOL><INDENT>if func == bool:<EOL><INDENT>return bool(int(value))<EOL><DEDENT>elif func in (int, float):<EOL><INDENT>try:<EOL><INDENT>return func(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>return float('<STR_LIT>')<EOL><DEDENT><DEDENT>return func(value)<EOL><DEDENT>return value<EOL>
Cast the specified value to the specified type (returned by func). Currently this
        only support int, float, bool. Should be extended if needed.

        Parameters:
            func (func): Calback function to used cast to type (int, bool, float).
            value (any): value to be cast and returned.