def get_spool(self, task):
        """Query hacheck for the state of a task, and parse the result into a dictionary."""
        response = requests.get(self.spool_url(task))
        if response.status_code == 200:
            return {
                'state': 'up',
            }

        regex = ''.join([
            "^",
            r"Service (?P<service>.+)",
            r" in (?P<state>.+) state",
            r"(?: since (?P<since>[0-9.]+))?",
            r"(?: until (?P<until>[0-9.]+))?",
            r"(?:: (?P<reason>.*))?",
            "$"
        ])
        match = re.match(regex, response.text)
        groupdict = match.groupdict()
        info = {}
        info['service'] = groupdict['service']
        info['state'] = groupdict['state']
        if 'since' in groupdict:
            info['since'] = float(groupdict['since'] or 0)
        if 'until' in groupdict:
            info['until'] = float(groupdict['until'] or 0)
        if 'reason' in groupdict:
            info['reason'] = groupdict['reason']
        return info
dataset/ETHPy150Open Yelp/paasta/paasta_tools/drain_lib.py/HacheckDrainMethod.get_spool/original