def localize(value, locale):
    """ Return the value appropriate for the current locale.

        This is used to retrieve the appropriate localized version of a value
        defined within a unit's dictionary.

        If 'value' is a dictionary, we assume it is a mapping of locale names
        to values, so we select the appropriate dictionary entry based on the
        locale.  Otherwise, we return 'value' directly, as the value hasn't
        been localized.
    """
    if isinstance(value, dict):
        return value.get(locale)
    else:
        return value