'Get the latest system information.'

def update(self):

    import psutil
    if (self.type == 'disk_use_percent'):
        self._state = psutil.disk_usage(self.argument).percent
    elif (self.type == 'disk_use'):
        self._state = round((psutil.disk_usage(self.argument).used / (1024 ** 3)), 1)
    elif (self.type == 'disk_free'):
        self._state = round((psutil.disk_usage(self.argument).free / (1024 ** 3)), 1)
    elif (self.type == 'memory_use_percent'):
        self._state = psutil.virtual_memory().percent
    elif (self.type == 'memory_use'):
        self._state = round(((psutil.virtual_memory().total - psutil.virtual_memory().available) / (1024 ** 2)), 1)
    elif (self.type == 'memory_free'):
        self._state = round((psutil.virtual_memory().available / (1024 ** 2)), 1)
    elif (self.type == 'swap_use_percent'):
        self._state = psutil.swap_memory().percent
    elif (self.type == 'swap_use'):
        self._state = round((psutil.swap_memory().used / (1024 ** 3)), 1)
    elif (self.type == 'swap_free'):
        self._state = round((psutil.swap_memory().free / (1024 ** 3)), 1)
    elif (self.type == 'processor_use'):
        self._state = round(psutil.cpu_percent(interval=None))
    elif (self.type == 'process'):
        if any(((self.argument in l.name()) for l in psutil.process_iter())):
            self._state = STATE_ON
        else:
            self._state = STATE_OFF
    elif ((self.type == 'network_out') or (self.type == 'network_in')):
        counters = psutil.net_io_counters(pernic=True)
        if (self.argument in counters):
            counter = counters[self.argument][IO_COUNTER[self.type]]
            self._state = round((counter / (1024 ** 2)), 1)
        else:
            self._state = STATE_UNKNOWN
    elif ((self.type == 'packets_out') or (self.type == 'packets_in')):
        counters = psutil.net_io_counters(pernic=True)
        if (self.argument in counters):
            self._state = counters[self.argument][IO_COUNTER[self.type]]
        else:
            self._state = STATE_UNKNOWN
    elif ((self.type == 'ipv4_address') or (self.type == 'ipv6_address')):
        addresses = psutil.net_if_addrs()
        if (self.argument in addresses):
            self._state = addresses[self.argument][IF_ADDRS[self.type]][1]
        else:
            self._state = STATE_UNKNOWN
    elif (self.type == 'last_boot'):
        self._state = dt_util.as_local(dt_util.utc_from_timestamp(psutil.boot_time())).date().isoformat()
    elif (self.type == 'since_last_boot'):
        self._state = (dt_util.utcnow() - dt_util.utc_from_timestamp(psutil.boot_time()))
    elif (self.type == 'load_1m'):
        self._state = os.getloadavg()[0]
    elif (self.type == 'load_5m'):
        self._state = os.getloadavg()[1]
    elif (self.type == 'load_15m'):
        self._state = os.getloadavg()[2]
