<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_data_table( energy, flux, flux_error=None, flux_error_lo=None, flux_error_hi=None, energy_width=None, energy_lo=None, energy_hi=None, ul=None, cl=None, ):
 """ Read data into data dict. Parameters energy : :class:`~astropy.units.Quantity` array instance Observed photon energy array [physical type ``energy``] flux : :class:`~astropy.units.Quantity` array instance Observed flux array [physical type ``flux`` or ``differential flux``] flux_error, flux_error_hi, flux_error_lo : :class:`~astropy.units.Quantity` array instance 68% CL gaussian uncertainty of the flux [physical type ``flux`` or ``differential flux``]. Either ``flux_error`` (symmetrical uncertainty) or ``flux_error_hi`` and ``flux_error_lo`` (asymmetrical uncertainties) must be provided. energy_width, energy_lo, energy_hi : :class:`~astropy.units.Quantity` array instance, optional Width of the energy bins [physical type ``energy``]. Either ``energy_width`` (bin width) or ``energy_lo`` and ``energy_hi`` (Energies of the lower and upper bin edges) can be provided. If none are provided, ``generate_energy_edges`` will be used. ul : boolean or int array, optional Boolean array indicating which of the flux values given in ``flux`` correspond to upper limits. cl : float, optional Confidence level of the flux upper limits given by ``ul``. Returns ------- data : :class:`astropy.table.QTable` Data stored in an astropy Table. """

    table = QTable()

    if cl is not None:
        cl = validate_scalar("cl", cl)
        table.meta["keywords"] = {"cl": {"value": cl}}

    table["energy"] = energy

    if energy_width is not None:
        table["energy_width"] = energy_width
    elif energy_lo is not None and energy_hi is not None:
        table["energy_lo"] = energy_lo
        table["energy_hi"] = energy_hi

    table["flux"] = flux

    if flux_error is not None:
        table["flux_error"] = flux_error
    elif flux_error_lo is not None and flux_error_hi is not None:
        table["flux_error_lo"] = flux_error_lo
        table["flux_error_hi"] = flux_error_hi
    else:
        raise TypeError("Flux error not provided!")

    if ul is not None:
        ul = np.array(ul, dtype=np.int)
        table["ul"] = ul

    table.meta["comments"] = ["Table generated with naima.build_data_table"]

    # test table units, format, etc
    validate_data_table(table)

    return table