def get_language_pairs(self, train_langs=None):
        '''
            Returns the language pairs available on unbabel
        '''
        if train_langs is None:
            result = self.api_call('language_pair/')
        else:
            result = self.api_call(
                'language_pair/?train_langs={}'.format(train_langs))
        try:
            langs_json = json.loads(result.content)
            if 'error' in langs_json:
                return []
            languages = [LangPair(Language(
                shortname=lang_json["lang_pair"]["source_language"][
                    "shortname"],
                name=lang_json["lang_pair"]["source_language"]["name"]),
                Language(shortname=lang_json["lang_pair"][
                    "target_language"]["shortname"],
                         name=lang_json["lang_pair"][
                             "target_language"]["name"])
            ) for lang_json in langs_json["objects"]]
        except Exception, e:
            log.exception("Error decoding get language pairs")
            raise e
        return languages