def _f2s(number, dec=4):
    """
    Return string representation of ``number``.

    Returned string is:

        * without trailing decimal zeros,
        * with at most ``dec`` decimal places.
    """
    if not isinstance(number, (int, float)):
        return number
    return '{{:.{:d}f}}'.format(dec).format(number).rstrip('0').rstrip('.')