<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_cosmology(cosmology=None, **kwargs):
 r"""Gets an astropy cosmology class. Parameters cosmology : str or astropy.cosmology.FlatLambdaCDM, optional The name of the cosmology to use. For the list of options, see :py:attr:`astropy.cosmology.parameters.available`. If None, and no other keyword arguments are provided, will default to :py:attr:`DEFAULT_COSMOLOGY`. If an instance of :py:class:`astropy.cosmology.FlatLambdaCDM`, will just return that. \**kwargs : If any other keyword arguments are provided they will be passed to :py:attr:`astropy.cosmology.FlatLambdaCDM` to create a custom cosmology. Returns ------- astropy.cosmology.FlatLambdaCDM The cosmology to use. Examples -------- Use the default: FlatLambdaCDM(name="Planck15", H0=67.7 km / (Mpc s), Om0=0.307, Tcmb0=2.725 K, Neff=3.05, m_nu=[0. 0. 0.06] eV, Ob0=0.0486) Use properties measured by WMAP instead: FlatLambdaCDM(name="WMAP9", H0=69.3 km / (Mpc s), Om0=0.286, Tcmb0=2.725 K, Neff=3.04, m_nu=[0. 0. 0.] eV, Ob0=0.0463) Create your own cosmology (see :py:class:`astropy.cosmology.FlatLambdaCDM` for details on the default values used):
 FlatLambdaCDM(H0=70 km / (Mpc s), Om0=0.3, Tcmb0=0 K, Neff=3.04, m_nu=None, Ob0=None) """

    if kwargs and cosmology is not None:
        raise ValueError("if providing custom cosmological parameters, do "
                         "not provide a `cosmology` argument")
    if isinstance(cosmology, astropy.cosmology.FlatLambdaCDM):
        # just return
        return cosmology
    if kwargs:
        cosmology = astropy.cosmology.FlatLambdaCDM(**kwargs)
    else:
        if cosmology is None:
            cosmology = DEFAULT_COSMOLOGY
        if cosmology not in astropy.cosmology.parameters.available:
            raise ValueError("unrecognized cosmology {}".format(cosmology))
        cosmology = getattr(astropy.cosmology, cosmology)
    return cosmology