'The function for parsing the JSON response to the vars dictionary.'

def parse(self):

    try:
        self.vars['handle'] = self.json['handle'].strip()
    except (KeyError, ValueError):
        log.debug('Handle    missing,    json_output:    {0}'.format(json.dumps(self.json)))
        raise InvalidNetworkObject('Handle    is    missing    for    RDAP    network    object')
    try:
        self.vars['ip_version'] = self.json['ipVersion'].strip()
        if (self.vars['ip_version'] == 'v4'):
            self.vars['start_address'] = ip_address(ipv4_lstrip_zeros(self.json['startAddress'])).__str__()
            self.vars['end_address'] = ip_address(ipv4_lstrip_zeros(self.json['endAddress'])).__str__()
        else:
            self.vars['start_address'] = self.json['startAddress'].strip()
            self.vars['end_address'] = self.json['endAddress'].strip()
    except (KeyError, ValueError, TypeError):
        log.debug('IP    address    data    incomplete.    Data    parsed    prior    to    exception:    {0}'.format(json.dumps(self.vars)))
        raise InvalidNetworkObject('IP    address    data    is    missing    for    RDAP    network    object.')
    try:
        self.vars['cidr'] = ',    '.join(calculate_cidr(self.vars['start_address'], self.vars['end_address']))
    except (KeyError, ValueError, TypeError, AttributeError) as e:
        log.debug('CIDR    calculation    failed:    {0}'.format(e))
        pass
    for v in ['name', 'type', 'country']:
        try:
            self.vars[v] = self.json[v].strip()
        except (KeyError, ValueError):
            pass
    try:
        self.vars['parent_handle'] = self.json['parentHandle'].strip()
    except (KeyError, ValueError):
        pass
    self._parse()
