def to_curve_spline(obj):
if   is_curve_spline(obj):            return obj<EOL>elif is_tuple(obj) and len(obj) == <NUM_LIT:2>: (crds,opts) = obj<EOL>else:                                 (crds,opts) = (obj,{})<EOL>if pimms.is_matrix(crds) or is_curve_spline(crds): crds = [crds]<EOL>spls = [c for c in crds if is_curve_spline(c)]<EOL>opts = dict(opts)<EOL>if '<STR_LIT>' not in opts and len(spls) == len(crds):<EOL><INDENT>if all(c.weights is not None for c in crds):<EOL><INDENT>opts['<STR_LIT>'] = np.concatenate([c.weights for c in crds])<EOL><DEDENT><DEDENT>if '<STR_LIT>' not in opts and len(spls) > <NUM_LIT:0>:<EOL><INDENT>opts['<STR_LIT>'] = np.min([c.order for c in spls])<EOL><DEDENT>if '<STR_LIT>' not in opts and len(spls) > <NUM_LIT:0>:<EOL><INDENT>sm = set([c.smoothing for c in spls])<EOL>if len(sm) == <NUM_LIT:1>: opts['<STR_LIT>'] = list(sm)[<NUM_LIT:0>]<EOL>else: opts['<STR_LIT>'] = None<EOL><DEDENT>crds = [x.crds if is_curve_spline(crds) else np.asarray(x) for x in crds]<EOL>crds = [x if x.shape[<NUM_LIT:0>] == <NUM_LIT:2> else x.T for x in crds]<EOL>crds = np.hstack(crds)<EOL>return curve_spline(crds, **opts)<EOL>
to_curve_spline(obj) obj if obj is a curve spline and otherwise attempts to coerce obj into a
  curve spline, raising an error if it cannot.