base function for connecting to API

def get_list(self, datatype, url, **kwargs):
        """base function for connecting to API"""
        search_url = [url, '?']
        kwargs.update({'key': self.api_key})
        search_url.append(urlencode(kwargs))
        data = json.loads(urlopen(''.join(search_url)).read())
        return data[datatype]