def METHOD_NAME(max_default: Optional[int], default: int, unit: TimeUnit) -> int:
    """Return the max time buffer for a give time unit."""
    mag_default = abs(int(default * 4))
    if max_default is not None:
        max_value = abs(max_default)
        return max(max_value, mag_default)
    if unit == TimeUnit.DAY:
        return max(28, mag_default)
    if unit == TimeUnit.HOUR:
        return max(72, mag_default)
    if unit == TimeUnit.WEEK:
        return max(20, mag_default)
    return max(240, mag_default)