code: def parse_dbus_address(address):
      
      if address == 'session':
          address = os.environ.get('DBUS_SESSION_BUS_ADDRESS')
          if not address:
              raise ValueError('$DBUS_SESSION_BUS_ADDRESS not set')
      elif address == 'system':
          address = os.environ.get('DBUS_SYSTEM_BUS_ADDRESS',
                                   'unix:path=/var/run/dbus/system_bus_socket')
      addresses = []
      for addr in address.split(';'):
          p1 = addr.find(':')
          if p1 == -1:
              raise ValueError('illegal address string: {}'.format(addr))
          kind = addr[:p1]
          args = dict((kv.split('=') for kv in addr[p1+1:].split(',')))
          if kind == 'unix':
              if 'path' in args:
                  addr = args['path']
              elif 'abstract' in args:
                  addr = '\0' + args['abstract']
              else:
                  raise ValueError('require "path" or "abstract" for unix')
          elif kind == 'tcp':
              if 'host' not in args or 'port' not in args:
                  raise ValueError('require "host" and "port" for tcp')
              addr = (args['host'], int(args['port']))
          else:
              raise ValueError('unknown transport: {}'.format(kind))
          addresses.append(addr)
      return addresses
docs: Parse a D-BUS address string into a list of addresses.