'General-purpose function to create web requests to SHODAN.
Arguments:
function  -- name of the function you want to execute
params      -- dictionary of parameters for the function
Returns
A JSON string containing the function\'s results.'

def _request(self, function, params):

    params['key'] = self.api_key
    data = urlopen((((self.base_url + function) + '?') + urlencode(params))).read()
    data = loads(data)
    if data.get('error', None):
        raise WebAPIError(data['error'])
    return data
