def h(size):
    """Format 'size' (given in bytes) using KB, MB, GB, or TB as needed."""
    if abs(size) < 1024:
        return f"{size:,.0f} bytes"

    elif abs(size) < 1024**2:
        return f"{size/1024:,.2f} KB"

    elif abs(size) < 1024**3:
        return f"{size/1024**2:,.3f} MB"

    elif abs(size) < 1024**4:
        return f"{size/1024**3:,.3f} GB"

    else:
        """
        Seriously.... Who is going to encode a media file
        measuring in terabytes?
        """
        return f"{size/1024**4:,.3f} TB"