title: How to extract all coefficients in sympy
body: <p>You can get a coefficient of a specific term by using coeff();</p>
  
  <pre><code>x, a = symbols("x, a")
  expr = 3 + x + x**2 + a*x*2
  expr.coeff(x)
  # 2*a + 1
  </code></pre>
  
  <p>Here I want to extract all the coefficients of x, x**2 (and so on), like;</p>
  
  <pre><code># for example
  expr.coefficients(x)
  # want {1: 3, x: (2*a + 1), x**2: 1}
  </code></pre>
  
  <p>There is a method as_coefficients_dict(), but it seems this doesn't work in the way I want;</p>
  
  <pre><code>expr.as_coefficients_dict()
  # {1: 3, x: 1, x**2: 1, a*x: 2}
  expr.collect(x).as_coefficients_dict()
  # {1: 3, x**2: 1, x*(2*a + 1): 1}
  </code></pre>