def google(rest):
	"Look up a phrase on google"
	API_URL = 'https://www.googleapis.com/customsearch/v1?'
	try:
		key = pmxbot.config['Google API key']
	except KeyError:
		return "Configure 'Google API key' in config"
	# Use a custom search that searches everything normally
	# http://stackoverflow.com/a/11206266/70170
	custom_search = '004862762669074674786:hddvfu0gyg0'
	params = dict(
		key=key,
		cx=custom_search,
		q=rest.strip(),
	)
	url = API_URL + urllib.parse.urlencode(params)
	resp = requests.get(url)
	resp.raise_for_status()
	results = resp.json()
	hit1 = next(iter(results['items']))
	return ' - '.join((
		urllib.parse.unquote(hit1['link']),
		hit1['title'],
	))
Look up a phrase on google