def cast(s):
if not isinstance(s, basestring):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>for test in [int, float, str]:<EOL><INDENT>try:<EOL><INDENT>return test(s)<EOL><DEDENT>except ValueError:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>return str(s)<EOL>
Cast a basestring to a more appropriate type.
Example::
    >>> from yaxil import cast
    >>> type(cast("999"))
    <type 'int'>

:param s: String
:type s: basestring
:returns: Casted string
:rtype: int|float|str