<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_ip(self, ip):
 """ Queries Circl.lu Passive SSL for an ip using PyPSSL class. Returns error if nothing is found. :param ip: IP to query for :type ip: str :returns: python dict of results :rtype: dict """

        try:
            result = self.pssl.query(ip)
        except:
            self.error('Exception during processing with passiveSSL. '
                       'Please check the format of ip.')

        # Check for empty result
        # result is always assigned, self.error exits the function.
        if not result.get(ip, None):
            certificates = []
        else:
            certificates = list(result.get(ip).get('certificates'))

        newresult = {'ip': ip,
                     'certificates': []}
        for cert in certificates:
            newresult['certificates'].append({'fingerprint': cert,
                                              'subject': result.get(ip).get('subjects').get(cert).get('values')[0]})
        return newresult