<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_file(file_path, incl_pot=True):
 """ Load catchment object from a ``.CD3`` or ``.xml`` file. If there is also a corresponding ``.AM`` file (annual maximum flow data) or a ``.PT`` file (peaks over threshold data) in the same folder as the CD3 file, these datasets will also be loaded. :param file_path: Location of CD3 or xml file :type file_path: str :return: Catchment object with the :attr:`amax_records` and :attr:`pot_dataset` attributes set (if data available). :rtype: :class:`.entities.Catchment` :param incl_pot: Whether to load the POT (peaks-over-threshold) data. Default: ``True``. :type incl_pot: bool """

    filename, ext = os.path.splitext(file_path)
    am_file_path = filename + '.AM'
    pot_file_path = filename + '.PT'
    parser_by_ext = {
        '.cd3': parsers.Cd3Parser,
        '.xml': parsers.XmlCatchmentParser
    }
    catchment = parser_by_ext[ext.lower()]().parse(file_path)

    # AMAX records
    try:
        catchment.amax_records = parsers.AmaxParser().parse(am_file_path)
    except FileNotFoundError:
        catchment.amax_records = []

    # POT records
    if incl_pot:
        try:
            catchment.pot_dataset = parsers.PotParser().parse(pot_file_path)
        except FileNotFoundError:
            pass

    return catchment