def construct_domain(obj, **args):
    'Construct a minimal domain for the list of coefficients. '
    opt = build_options(args)
    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            (monoms, coeffs) = zip(*obj.items())
        else:
            coeffs = obj
    else:
        coeffs = [obj]
    coeffs = map(sympify, coeffs)
    result = _construct_simple(coeffs, opt)
    if (result is not None):
        if (result is not False):
            (domain, coeffs) = result
        else:
            (domain, coeffs) = _construct_expression(coeffs, opt)
    else:
        if opt.composite:
            result = _construct_composite(coeffs, opt)
        else:
            result = None
        if (result is not None):
            (domain, coeffs) = result
        else:
            (domain, coeffs) = _construct_expression(coeffs, opt)
    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            return (domain, dict(zip(monoms, coeffs)))
        else:
            return (domain, coeffs)
    else:
        return (domain, coeffs[0])
Construct a minimal domain for the list of coefficients.
def construct_domain(obj, **args):
    ' '
    opt = build_options(args)
    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            (monoms, coeffs) = zip(*obj.items())
        else:
            coeffs = obj
    else:
        coeffs = [obj]
    coeffs = map(sympify, coeffs)
    result = _construct_simple(coeffs, opt)
    if (result is not None):
        if (result is not False):
            (domain, coeffs) = result
        else:
            (domain, coeffs) = _construct_expression(coeffs, opt)
    else:
        if opt.composite:
            result = _construct_composite(coeffs, opt)
        else:
            result = None
        if (result is not None):
            (domain, coeffs) = result
        else:
            (domain, coeffs) = _construct_expression(coeffs, opt)
    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            return (domain, dict(zip(monoms, coeffs)))
        else:
            return (domain, coeffs)
    else:
        return (domain, coeffs[0])