def TWA(CASRN, AvailableMethods=False, Method=None):  
def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in _OntarioExposureLimits and (_OntarioExposureLimits[CASRN]["<STR_LIT>"] or _OntarioExposureLimits[CASRN]["<STR_LIT>"]):<EOL><INDENT>methods.append(ONTARIO)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == ONTARIO:<EOL><INDENT>if _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_TWA = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT>elif _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_TWA = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT><DEDENT>elif Method == NONE:<EOL><INDENT>_TWA = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _TWA<EOL>
This function handles the retrieval of Time-Weighted Average limits on worker
    exposure to dangerous chemicals.

    This API is considered experimental, and is expected to be removed in a
    future release in favor of a more complete object-oriented interface.

    >>> TWA('98-00-0')
    (10.0, 'ppm')
    >>> TWA('1303-00-0')
    (5.0742430905659505e-05, 'ppm')
    >>> TWA('7782-42-5', AvailableMethods=True)
    ['Ontario Limits', 'None']