<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_dos(vasprun, elements=None, lm_orbitals=None, atoms=None, gaussian=None, total_only=False, log=False, adjust_fermi=True):
 """Load a vasprun and extract the total and projected density of states. Args: vasprun (str):
 Path to a vasprun.xml or vasprun.xml.gz file or a :obj:`pymatgen.io.vasp.outputs.Vasprun` object. elements (:obj:`dict`, optional):
 The elements and orbitals to extract from the projected density of states. Should be provided as a :obj:`dict` with the keys as the element names and corresponding values as a :obj:`tuple` of orbitals. For example, the following would extract the Bi s, px, py and d orbitals:: {'Bi': ('s', 'px', 'py', 'd')} If an element is included with an empty :obj:`tuple`, all orbitals for that species will be extracted. If ``elements`` is not set or set to ``None``, all elements for all species will be extracted. lm_orbitals (:obj:`dict`, optional):
 The orbitals to decompose into their lm contributions (e.g. p -> px, py, pz). Should be provided as a :obj:`dict`, with the elements names as keys and a :obj:`tuple` of orbitals as the corresponding values. For example, the following would be used to decompose the oxygen p and d orbitals:: {'O': ('p', 'd')} atoms (:obj:`dict`, optional):
 Which atomic sites to use when calculating the projected density of states. Should be provided as a :obj:`dict`, with the element names as keys and a :obj:`tuple` of :obj:`int` specifying the atomic indices as the corresponding values. The elemental projected density of states will be summed only over the atom indices specified. If an element is included with an empty :obj:`tuple`, then all sites for that element will be included. The indices are 0 based for each element specified in the POSCAR. For example, the following will calculate the density of states for the first 4 Sn atoms and all O atoms in the structure:: {'Sn': (1, 2, 3, 4), 'O': (, )} If ``atoms`` is not set or set to ``None`` then all atomic sites for all elements will be considered. gaussian (:obj:`float`, optional):
 Broaden the density of states using convolution with a gaussian function. This parameter controls the sigma or standard deviation of the gaussian distribution. total_only (:obj:`bool`, optional):
 Only extract the total density of states. Defaults to ``False``. log (:obj:`bool`):
 Print logging messages. Defaults to ``False``. adjust_fermi (:obj:`bool`, optional):
 Shift the Fermi level to sit at the valence band maximum (does not affect metals). Returns: dict: The total and projected density of states. Formatted as a :obj:`tuple` of ``(dos, pdos)``, where ``dos`` is a :obj:`~pymatgen.electronic_structure.dos.Dos` object containing the total density of states and ``pdos`` is a :obj:`dict` of :obj:`dict` mapping the elements and their orbitals to :obj:`~pymatgen.electronic_structure.dos.Dos` objects. For example:: { 'S': {'s': Dos} } """

    if isinstance(vasprun, str):
        vr = Vasprun(vasprun)
    else:
        vr = vasprun

    band = vr.get_band_structure()
    dos = vr.complete_dos

    if band.is_metal():
        if log:
            logging.info('System is metallic')
        zero_point = vr.efermi
    else:
        if log:
            logging.info('Band gap: {:.3f}'.
                         format(band.get_band_gap()['energy']))
            logging.info('DOS band gap: {:.3f}'.format(dos.get_gap()))
        zero_point = band.get_vbm()['energy']

    if adjust_fermi:
        dos.efermi -= dos.efermi - zero_point

    if vr.parameters['ISMEAR'] in [-1, 0, 1]:
        dos.energies -= vr.parameters['SIGMA']

    if gaussian:
        dos.densities = dos.get_smeared_densities(gaussian)
        for site in dos.pdos:
            for orbital in dos.pdos[site]:
                dos.pdos[site][orbital] = dos.get_site_orbital_dos(
                    site, orbital).get_smeared_densities(gaussian)

    if vr.parameters['LSORBIT']:
        # pymatgen includes the spin down channel for SOC calculations, even
        # though there is no density here. We remove this channel so the
        # plotting is easier later on.
        del dos.densities[Spin.down]
        for site in dos.pdos:
            for orbital in dos.pdos[site]:
                del dos.pdos[site][orbital][Spin.down]

    pdos = {}
    if not total_only:
        pdos = get_pdos(dos, lm_orbitals=lm_orbitals, atoms=atoms,
                        elements=elements)
    return dos, pdos