def to_map_projection(arg, hemi=Ellipsis, chirality=Ellipsis,<EOL>center=Ellipsis, center_right=Ellipsis, radius=Ellipsis,<EOL>method=Ellipsis, registration=Ellipsis, sphere_radius=Ellipsis,<EOL>pre_affine=Ellipsis, post_affine=Ellipsis, meta_data=Ellipsis):
kw = dict(center=center, center_right=center_right, radius=radius, chirality=chirality,<EOL>method=method, registration=registration, sphere_radius=sphere_radius,<EOL>pre_affine=pre_affine, post_affine=post_affine, meta_data=meta_data)<EOL>kw = {k:v for (k,v) in six.iteritems(kw) if v is not Ellipsis}<EOL>if pimms.is_vector(arg):<EOL><INDENT>if   len(arg) == <NUM_LIT:1>: arg = arg[<NUM_LIT:0>]<EOL>elif len(arg) == <NUM_LIT:2>:<EOL><INDENT>(arg, tmp) = arg<EOL>if pimms.is_map(tmp):<EOL><INDENT>kw = {k:v for (k,v) in six.iteritems(pimms.merge(tmp, kw)) if v is not Ellipsis}<EOL><DEDENT>elif hemi is Ellipsis: hemi = arg<EOL><DEDENT>elif len(arg) == <NUM_LIT:3>:<EOL><INDENT>(arg, h, opts) = arg<EOL>kw = {k:v for (k,v) in six.iteritems(pimms.merge(opts, kw)) if v is not Ellipsis}<EOL>if hemi is Ellipsis: hemi = h<EOL><DEDENT>else: raise ValueError('<STR_LIT>')<EOL><DEDENT>hemi = deduce_chirality(hemi)<EOL>mp = None<EOL>if   is_map_projection(arg): mp = arg<EOL>elif pimms.is_str(arg):<EOL><INDENT>if '<STR_LIT::>' in arg:<EOL><INDENT>spl = arg.split('<STR_LIT::>')<EOL>(a,h) = ('<STR_LIT::>'.join(spl[:-<NUM_LIT:1>]), spl[-<NUM_LIT:1>])<EOL>try:<EOL><INDENT>(hemtmp, arg) = (to_hemi_str(h), a)<EOL>if hemi is None: hemi = hemtmp<EOL><DEDENT>except Exception: pass<EOL><DEDENT>mp = map_projection(arg, hemi)<EOL><DEDENT>else: raise ValueError('<STR_LIT>')<EOL>if len(kw) == <NUM_LIT:0>: return mp<EOL>else: return mp.copy(**kw)<EOL>
to_map_projection(mp) yields mp if mp is a map projection object.
to_map_projection((name, hemi)) is equivalent to map_projection(name, chirality=hemi).
to_map_projection((name, opts)) uses the given options dictionary as options to map_projection;
  (name, hemi, opts) is also allowed as input.
to_map_projection(filename) yields the map projection loaded from the given filename.
to_map_projection('<name>:<hemi>') is equivalent to to_map_projection(('<name>', '<hemi>')).
to_map_projection('<name>') is equivalent to to_map_projection(('<name>', 'lr')).
to_map_projection((affine, hemi)) converts the given affine transformation, which must be a
  transformation from spherical coordinates to 2D map coordinates (once the transformed z-value
  is dropped), to a map projection. The hemi argument may alternately be an options mapping.

The to_map_projection() function may also be called with the the elements of the above tuples
passed directly; i.e. to_map_projection(name, hemi) is equivalent to
to_map_projection((name,hemi)).

Additionaly, all optional arguments to the map_projection function may be given and will be
copied into the map_projection that is returned. Note that the named chirality argument is used
to set the chirality of the returned map projection but never to specify the chirality of a
map projection that is being looked up or loaded; for that use the second argument, second tuple
entry, or hemi keyword.