code: def _valid_expr(expr):
      """
      return coefficients of expr if it is a univariate polynomial
      with integer coefficients else raise a ValueError.
      """
  
      if not expr.is_polynomial():
          raise ValueError("The expression should be a polynomial")
      polynomial = Poly(expr)
      if not polynomial.is_univariate:
          raise ValueError("The expression should be univariate")
      if not polynomial.domain == ZZ:
          raise ValueError(
              "The expression should should have integer coefficients"
          )
      return polynomial.all_coeffs()
  
imports: from __future__ import annotations
  from sympy.external.gmpy import gcd, lcm, invert, sqrt, legendre, jacobi, kronecker, bit_scan1, remove
  from sympy.polys import Poly
  from sympy.polys.domains import ZZ
  from sympy.polys.galoistools import gf_crt1, gf_crt2, linear_congruence, gf_csolve
  from .primetest import isprime
  from .factor_ import factorint, _perfect_power
  from .modular import crt
  from sympy.utilities.decorator import deprecated
  from sympy.utilities.memoization import recurrence_memo
  from sympy.utilities.misc import as_int
  from sympy.utilities.iterables import iproduct
  from sympy.core.random import _randint, randint
  from itertools import product
label_desc: Use image node_id 29 for calling a global function with example usage: _valid_expr(expr) and returns: polynomial