'Returns the homogeneous order of ``f``.
A homogeneous polynomial is a polynomial whose all monomials with
non-zero coefficients have the same total degree. This degree is
the homogeneous order of ``f``. If you only want to check if a
polynomial is homogeneous, then use :func:`Poly.is_homogeneous`.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x, y
>>> f = Poly(x**5 + 2*x**3*y**2 + 9*x*y**4)
>>> f.homogeneous_order()
5'

def homogeneous_order(f):

    if hasattr(f.rep, 'homogeneous_order'):
        return f.rep.homogeneous_order()
    else:
        raise OperationNotSupported(f, 'homogeneous_order')
