def format_decimalized_number(number, decimal=1):
    """Format a number to display to nearest metrics unit next to it.

    Do not display digits if all visible digits are null.
    Do not display units higher then "Tera" because most of people don't know what
    a "Yotta" is.

    >>> format_decimalized_number(123_456.789)
    123.5k
    >>> format_decimalized_number(123_000.789)
    123k
    >>> format_decimalized_number(-123_456.789)
    -123.5k
    >>> format_decimalized_number(0.789)
    0.8
    """
    for unit in ['', 'k', 'M', 'G']:
        if abs(number) < 1000.0:
            return "%g%s" % (round(number, decimal), unit)
        number /= 1000.0
    return "%g%s" % (round(number, decimal), 'T')