code: def _live_entity_map(self, entity_type):
          
          return {
              entity_id: self.get_entity(entity_type, entity_id)
              for entity_id, history in self.state.get(entity_type, {}).items()
              if history[-1] is not None
          }
docs: Return an id:Entity map of all the living entities of
          type ``entity_type``.