human
Give me a Python program to compute partial fraction decomposition of a rational function given the following:
Complete the below
@public
def apart_list(f, x=None, dummies=None, **options):

    ''''Compute partial fraction decomposition of a rational function
    and return the result in structured form.
    Given a rational function ``f`` compute the partial fraction decomposition
    of ``f``. Only Bronstein\'s full partial fraction decomposition algorithm
    is supported by this method. The return value is highly structured and
    perfectly suited for further algorithmic treatment rather than being
    human-readable. The function returns a tuple holding three elements:
    * The first item is the common coefficient, free of the variable `x` used
    for decomposition. (It is an element of the base field `K`.)
    * The second item is the polynomial part of the decomposition. This can be
    the zero polynomial. (It is an element of `K[x]`.)
    * The third part itself is a list of quadruples. Each quadruple
    has the following elements in this order:
    - The (not necessarily irreducible) polynomial `D` whose roots `w_i` appear
    in the linear denominator of a bunch of related fraction terms. (This item
    can also be a list of explicit roots. However, at the moment ``apart_list``
    never returns a result this way, but the related ``assemble_partfrac_list``
    function accepts this format as input.)
    - The numerator of the fraction, written as a function of the root `w`
    - The linear denominator of the fraction *excluding its power exponent*,
    written as a function of the root `w`.
    - The power to which the denominator has to be raised.
    On can always rebuild a plain expression by using the function ``assemble_partfrac_list``.
    Examples
    A first example:
    >>> from sympy.polys.partfrac import apart_list, assemble_partfrac_list
    >>> from sympy.abc import x, t
    >>> f = (2*x**3 - 2*x) / (x**2 - 2*x + 1)
    >>> pfd = apart_list(f)
    >>> pfd
    (1,
    Poly(2*x + 4, x, domain=\'ZZ\'),
    [(Poly(_w - 1, _w, domain=\'ZZ\'), Lambda(_a, 4), Lambda(_a, -_a + x), 1)])
    >>> assemble_partfrac_list(pfd)
    2*x + 4 + 4/(x - 1)
    Second example:
    >>> f = (-2*x...'''
assistant
#Here is Python program to compute partial fraction decomposition of a rational function
.
    allowed_flags(options, [])
    f = sympify(f)
    if f.is_Atom:
        return f
    else:
        (P, Q) = f.as_numer_denom()
    options = set_defaults(options, extension=True)
    ((P, Q), opt) = parallel_poly_from_expr((P, Q), x, **options)
    if P.is_multivariate:
        raise NotImplementedError('multivariate    partial    fraction    decomposition')
    (common, P, Q) = P.cancel(Q)
    (poly, P) = P.div(Q, auto=True)
    (P, Q) = P.rat_clear_denoms(Q)
    polypart = poly
    if (dummies is None):
        def dummies(name):
            d = Dummy(name)
            while True:
                (yield d)
        dummies = dummies('w')
    rationalpart = apart_list_full_decomposition(P, Q, dummies)
    return (common, polypart, rationalpart)