<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getBestTranslation(basedir, lang=None):
 """ Find inside basedir the best translation available. lang, if defined, should be a list of prefered languages. It will look for file in the form: - en-US.qm - en_US.qm - en.qm """

    if not lang:
        lang = QtCore.QLocale.system().uiLanguages()

    for l in lang:

        l = l.translate({ord('_'): '-'})
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

        l = l.translate({ord('-'): '_'})
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

        l = l.split('_')[0]
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

    else:
        return None

    translator = QtCore.QTranslator()
    translator.load(f)
    return translator