def _get_units(target, av_corr, flux_cal={}):
    """Determine the amplitude units of a target.

    Parameters
    ----------
    target : :class:`katpoint.Target`
        target whose amplitude units are to be obtained
    av_corr : dict
        dict with model flux densities, keyed by target.name + '_model'
    flux_cal : dict, optional
        dict of flux calibrated targets

    Returns
    -------
    str : units
    """
    # targets with these tags are implicitly flux-calibrated
    # by the pipeline if a flux model is provided
    implicit_tags = ['bpcal', 'bfcal']

    implicit_gain = any([t in target.tags for t in implicit_tags])
    model_key = target.name + '_model'
    is_model = model_key in av_corr
    is_flux = target.name in flux_cal.keys()

    if (implicit_gain and is_model) or is_flux:
        units = 'Jy'
    else:
        units = 'Counts'
    return units