def get_editor_cmd_from_environment():
    """
    Gets and editor command from environment variables.

    It first tries $VISUAL, then $EDITOR, following the same order git uses
    when it looks up edits. If neither is available, it returns None.
    """
    result = os.getenv(ENV_VISUAL)
    if (not result):
        result = os.getenv(ENV_EDITOR)
    return result
Gets and editor command from environment variables.

    It first tries $VISUAL, then $EDITOR, following the same order git uses
    when it looks up edits. If neither is available, it returns None.