<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def do_edit(self, args: argparse.Namespace) -> None: """Edit a file in a text editor"""

        if not self.editor:
            raise EnvironmentError("Please use 'set editor' to specify your text editing program of choice.")

        command = utils.quote_string_if_needed(os.path.expanduser(self.editor))
        if args.file_path:
            command += " " + utils.quote_string_if_needed(os.path.expanduser(args.file_path))

        self.do_shell(command)