'Given a Python operator (represented by a string, such as ``\'+\'``
or ``\'*\'``, and two model classes or instances, return a new compound
model that evaluates the given operator on the outputs of the left and
right input models.
If either of the input models are a model *class* (i.e. a subclass of
`~astropy.modeling.Model`) then the returned model is a new subclass of
`~astropy.modeling.Model` that may be instantiated with any parameter
values.  If both input models are *instances* of a model, a new class
is still created, but this method returns an *instance* of that class,
taking the parameter values from the parameters of the input model
instances.
If given, the ``additional_members`` `dict` may provide additional
class members that should be added to the generated
`~astropy.modeling.Model` subclass.  Some members that are generated by
this method should not be provided by ``additional_members``.  These
include ``_tree``, ``inputs``, ``outputs``, ``linear``,
``standard_broadcasting``, and ``__module__`.  This is currently for
internal use only.'

@classmethod
def _from_operator(mcls, operator, left, right, additional_members={}):

    children = []
    for child in (left, right):
        if isinstance(child, (_CompoundModelMeta, _CompoundModel)):
            u'\n                                                                Although    the    original    child    models    were    copied    we    make    another\n                                                                copy    here    to    ensure    that    changes    in    this    child    compound    model\n                                                                parameters    will    not    propagate    to    the    reuslt,    that    is\n                                                                cm1    =    Gaussian1D(1,    5,    .1)    +    Gaussian1D()\n                                                                cm2    =    cm1    |    Scale()\n                                                                cm1.amplitude_0    =    100\n                                                                assert(cm2.amplitude_0    ==    1)\n                                                                '
            children.append(copy.deepcopy(child._tree))
        elif isinstance(child, Model):
            children.append(ExpressionTree(child.copy()))
        else:
            children.append(ExpressionTree(child))
    tree = ExpressionTree(operator, left=children[0], right=children[1])
    name = str(u'CompoundModel{0}'.format(_CompoundModelMeta._nextid))
    _CompoundModelMeta._nextid += 1
    mod = find_current_module(3)
    if mod:
        modname = mod.__name__
    else:
        modname = u'__main__'
    (inputs, outputs) = mcls._check_inputs_and_outputs(operator, left, right)
    if (operator in (u'|', u'+', u'-')):
        linear = (left.linear and right.linear)
    else:
        linear = False
    standard_broadcasting = (left.standard_broadcasting and right.standard_broadcasting)
    members = additional_members
    members.update({u'_tree': tree, u'_is_dynamic': True, u'inputs': inputs, u'outputs': outputs, u'linear': linear, u'standard_broadcasting': standard_broadcasting, u'__module__': str(modname)})
    new_cls = mcls(name, (_CompoundModel,), members)
    if (isinstance(left, Model) and isinstance(right, Model)):
        instance = new_cls()
        instance._user_inverse = mcls._make_user_inverse(operator, left, right)
        if (left._n_models == right._n_models):
            instance._n_models = left._n_models
        else:
            raise ValueError(u'Model    sets    must    have    the    same    number    of    components.')
        return instance
    return new_cls
