code: async def sync_services(self):
          
  
          services = {}
          servs = await self.list_services()
  
          for i, serv in enumerate(servs):
              info = await self.service_info(serv)
              status = await self.service_status(serv)
              messages = await self.get_messages(serv)
              headline = await self.get_headline(serv)
  
              services[serv] = states.ServiceState(info['short_name'], info['long_name'], info['preregistered'], i)
              services[serv].state = status['numeric_status']
  
              for message in messages:
                  services[serv].post_message(message.level, message.message, message.count, message.created)
              if headline is not None:
                  services[serv].set_headline(headline.level, headline.message, headline.created)
  
          return services
docs: Poll the current state of all services.
  
          Returns:
              dict: A dictionary mapping service name to service status