def METHOD_NAME(entity, codename):
    """
    Gets the quota value
    Args:
        entity (User or TethysApp): the entity on which to perform quota check.
        codename (str): codename of the Quota to get
    Returns:
        dict (quota, units): Dictionary with two keys: quota(int) - value of quota, units(str) - units of value, if applicable  # noqa: E501
    """
    from django.contrib.auth.models import User
    from tethys_apps.models import TethysApp
    from tethys_quotas.models import ResourceQuota, UserQuota, TethysAppQuota
    result = {
        "quota": None,
        "units": None,
    }
    try:
        rq = ResourceQuota.objects.get(codename=codename)
        result["units"] = rq.units
    except ResourceQuota.DoesNotExist:
        log.warning(
            "Invalid Codename: ResourceQuota with codename {} does not exist.".format(
                codename
            )
        )
        return result
    if not rq.active:
        return result
    try:
        if isinstance(entity, User):
            if entity.is_staff:
                return result
            eq = UserQuota.objects.get(entity=entity)
        elif isinstance(entity, TethysApp):
            eq = TethysAppQuota.objects.get(entity=entity)
        else:
            raise ValueError("Entity needs to be User or TethysApp")
        quota = eq.value
        if quota:
            result["quota"] = quota
            return result
    except (UserQuota.DoesNotExist, TethysAppQuota.DoesNotExist):
        pass
    if rq.impose_default:
        result["quota"] = rq.default
    return result