def get_parent_language_code(parent_object):
    """
    .. versionadded:: 1.0

    Return the parent object language code.

    Tries to access ``get_current_language()`` and ``language_code`` attributes on the parent object.
    """
    if parent_object is None:
        return None

    try:
        # django-parler uses this attribute
        return parent_object.get_current_language()
    except AttributeError:
        pass

    try:
        # E.g. ContentItem.language_code
        return parent_object.language_code
    except AttributeError:
        pass

    return None