<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_catalog(**kwargs):
 """Build a `fermipy.catalog.Catalog` object Parameters catalog_type : str Specifies catalog type, options include 2FHL | 3FGL | 4FGLP catalog_file : str FITS file with catalog tables catalog_extdir : str Path to directory with extended source templates """

        catalog_type = kwargs.get('catalog_type')
        catalog_file = kwargs.get('catalog_file')
        catalog_extdir = kwargs.get('catalog_extdir')
        if catalog_type == '2FHL':
            return catalog.Catalog2FHL(fitsfile=catalog_file, extdir=catalog_extdir)
        elif catalog_type == '3FGL':
            return catalog.Catalog3FGL(fitsfile=catalog_file, extdir=catalog_extdir)
        elif catalog_type == '4FGLP':
            return catalog.Catalog4FGLP(fitsfile=catalog_file, extdir=catalog_extdir)
        elif catalog_type == 'FL8Y':
            return catalog.CatalogFL8Y(fitsfile=catalog_file, extdir=catalog_extdir)
        else:
            table = Table.read(catalog_file)
        return catalog.Catalog(table, extdir=catalog_extdir)