def METHOD_NAME(
    when: Optional[datetime.datetime],
    *,
    precise: bool = False,
    timezone: Optional[datetime.timezone] = None,
) -> str:
    """Humanizes the datetime
    When not in precise mode (precise=False), prints number of largest units
    for moments that are less then a day ago, and date just day otherwise:
    "32 seconds ago"
    "5 minutes ago"
    "11 hours age"
    "yesterday"
    "Jan 1"
    In precise mode (precise=True), prints two largest units for moments
    that are less then a day ago, and date with time otherwise:
    "32 seconds ago"
    "5 minutes and 22 seconds ago"
    "5 hours and 31 minutes ago"
    "yesterday at 14:22"
    "Jan 1 at 00:01"
    """
    if when is None:
        return ""
    assert when.tzinfo is not None
    delta = datetime.datetime.now(datetime.timezone.utc) - when
    if delta < datetime.timedelta(days=1):
        prefix = ""
        suffix = " ago"
        if delta != abs(delta):  # negative delta means lifespan ends in future
            prefix = "in "
            suffix = ""
        if precise:
            min_unit = "seconds"
            if abs(delta) > datetime.timedelta(hours=1):
                min_unit = "minutes"
            return (
                prefix
                + humanize.precisedelta(delta, minimum_unit=min_unit, format="%0.0f")
                + suffix
            )
        return prefix + humanize.naturaldelta(delta) + suffix
    else:
        when_local = when.astimezone(timezone)
        result = humanize.naturaldate(when_local)
        if precise:
            result = f"{result} at {when_local.strftime('%H:%M')} "
        return result