<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self):
 """ Fetch and parse stats """

        self.frontends = []
        self.backends = []
        self.listeners = []

        csv = [ l for l in self._fetch().strip(' #').split('\n') if l ]
        if self.failed:
            return

        #read fields header to create keys
        self.fields = [ f for f in csv.pop(0).split(',') if f ]
    
        #add frontends and backends first
        for line in csv:
            service = HAProxyService(self.fields, line.split(','), self.name)

            if service.svname == 'FRONTEND':
                self.frontends.append(service)
            elif service.svname == 'BACKEND':
                service.listeners = []
                self.backends.append(service)
            else:
                self.listeners.append(service)
    
        #now add listener  names to corresponding backends
        for listener in self.listeners:
            for backend in self.backends:
                if backend.iid == listener.iid:
                    backend.listeners.append(listener)

        self.last_update = datetime.utcnow()