<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_language_database():
    '''
    Return the language to be used to search the database contents
    '''
    lang = None
    language = get_language()
    if language:
        for x in settings.LANGUAGES_DATABASES:
            if x.upper() == language.upper():
                lang = language
                break

    if lang is None:
        lang = settings.LANGUAGES_DATABASES[0]
    return lang.lower()