'Translate the source text from one language to another.'

def translate(self, source, from_lang='auto', to_lang='en', host=None, type_=None):

    if PY2:
        source = source.encode('utf-8')
    data = {'q': source}
    url = u'{url}&sl={from_lang}&tl={to_lang}&hl={to_lang}&tk={tk}'.format(url=self.url, from_lang=from_lang, to_lang=to_lang, tk=_calculate_tk(source))
    response = self._request(url, host=host, type_=type_, data=data)
    result = json.loads(response)
    if isinstance(result, list):
        try:
            result = result[0]
        except IndexError:
            pass
    self._validate_translation(source, result)
    return result
