code: def from_dict(cls, d):
          
          labels_dict = d['labels_dict']
          projections = {}
          structure = None
          if isinstance(list(d['bands'].values())[0], dict):
              eigenvals = {Spin(int(k)): np.array(d['bands'][k]['data'])
                           for k in d['bands']}
          else:
              eigenvals = {Spin(int(k)): d['bands'][k] for k in d['bands']}
          if 'structure' in d:
              structure = Structure.from_dict(d['structure'])
          if d.get('projections'):
              projections = {Spin(int(spin)): np.array(v)
                             for spin, v in d["projections"].items()}
  
          return BandStructure(
              d['kpoints'], eigenvals,
              Lattice(d['lattice_rec']['matrix']), d['efermi'],
              labels_dict, structure=structure, projections=projections)
docs: Create from dict.
  
          Args:
              A dict with all data for a band structure object.
  
          Returns:
              A BandStructure object