def get_conversion_factor(unit, newunit, equiv=[], verbose=True):
    """Get the conversion factor for astropy units

    Args:
        unit: astropy unit
        newunit: astropy unit

    Returns:
        conversion_factor, validated unit
    """
    try:
        fac = (1 * unit).to(newunit, equivalencies=equiv).value
        return fac, newunit
    except:
        if verbose:
            print("ERROR: cannot convert these units: from {0} to {1}".format(
                    unit, newunit))
        fac = 1.0
        return fac, unit