<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def edit(gandi, g):
 """Edit config file with prefered text editor"""

    config_file = gandi.home_config if g else gandi.local_config
    path = os.path.expanduser(config_file)
    editor = gandi.get('editor')
    if not editor:
        try:
            editor = click.prompt("Please enter the path of your prefered "
                                  "editor. eg: '/usr/bin/vi' or 'vi'")
        except Abort:
            gandi.echo("""
Warning: editor is not configured.
You can use both 'gandi config set [-g] editor <value>'
or the $EDITOR environment variable to configure it.""")
            sys.exit(1)

    subprocess.call([editor, path])