'Update device state.'

def _update(self):

    import fedexdeliverymanager
    status_counts = defaultdict(int)
    for package in fedexdeliverymanager.get_packages(self._session):
        status = slugify(package['primary_status'])
        skip = ((status == STATUS_DELIVERED) and (parse_date(package['delivery_date']) < now().date()))
        if skip:
            continue
        status_counts[status] += 1
    self._attributes = {ATTR_ATTRIBUTION: fedexdeliverymanager.ATTRIBUTION}
    self._attributes.update(status_counts)
    self._state = sum(status_counts.values())
