'Returns the translation of the given string in the desired output language.
Google Translate is a paid service, license without billing raises HTTP401Authentication.'

def translate(self, string, input='en', output='fr', **kwargs):

    url = URL('https://www.googleapis.com/language/translate/v2?', method=GET, query={'key': (self.license or GOOGLE_LICENSE), 'q': string, 'source': input, 'target': output})
    kwargs.setdefault('cached', False)
    kwargs.setdefault('unicode', True)
    kwargs.setdefault('throttle', self.throttle)
    if (input == output):
        return string
    try:
        data = url.download(**kwargs)
    except HTTP403Forbidden:
        raise HTTP401Authentication('Google    translate    API    is    a    paid    service')
    data = json.loads(data)
    data = data.get('data', {}).get('translations', [{}])[0].get('translatedText', '')
    data = decode_entities(data)
    return u(data)
