'Find the best match between available and requested locale strings.
>>> Locale.negotiate([\'de_DE\', \'en_US\'], [\'de_DE\', \'de_AT\'])
<Locale "de_DE">
>>> Locale.negotiate([\'de_DE\', \'en_US\'], [\'en\', \'de\'])
<Locale "de">
>>> Locale.negotiate([\'de_DE\', \'de\'], [\'en_US\'])
You can specify the character used in the locale identifiers to separate
the differnet components. This separator is applied to both lists. Also,
case is ignored in the comparison:
>>> Locale.negotiate([\'de-DE\', \'de\'], [\'en-us\', \'de-de\'], sep=\'-\')
<Locale "de_DE">
:param preferred: the list of locale identifers preferred by the user
:param available: the list of locale identifiers available
:param aliases: a dictionary of aliases for locale identifiers
:return: the `Locale` object for the best match, or `None` if no match
was found
:rtype: `Locale`
:see: `negotiate_locale`'

def negotiate(cls, preferred, available, sep='_', aliases=LOCALE_ALIASES):

    identifier = negotiate_locale(preferred, available, sep=sep, aliases=aliases)
    if identifier:
        return Locale.parse(identifier, sep=sep)
