def energy_overlap(sp1, sp2):
    """
    Calculate the overlap energy range of two spectra, i.e. lower bound is the
    maximum of two spectra's minimum energy.
    Upper bound is the minimum of two spectra's maximum energy

    Args:
        sp1: Spectrum object 1
        sp2: Spectrum object 2

    Returns:
        Overlap energy range

    """
    overlap_range = [max(sp1.x.min(), sp2.x.min()), min(sp1.x.max(),
                                                        sp2.x.max())]
    return overlap_range