<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reply(self):
 """ Reply to the selected item. This is a utility method and should not be bound to a key directly. Item type: Submission - add a top level comment Comment - add a comment reply Message - reply to a private message """

        data = self.get_selected_item()

        if data['type'] == 'Submission':
            body = data['text']
            description = 'submission'
            reply = data['object'].add_comment
        elif data['type'] in ('Comment', 'InboxComment'):
            body = data['body']
            description = 'comment'
            reply = data['object'].reply
        elif data['type'] == 'Message':
            body = data['body']
            description = 'private message'
            reply = data['object'].reply
        else:
            self.term.flash()
            return

        # Construct the text that will be displayed in the editor file.
        # The post body will be commented out and added for reference
        lines = ['  |' + line for line in body.split('\n')]
        content = '\n'.join(lines)
        comment_info = docs.REPLY_FILE.format(
            author=data['author'],
            type=description,
            content=content)

        with self.term.open_editor(comment_info) as comment:
            if not comment:
                self.term.show_notification('Canceled')
                return

            with self.term.loader('Posting {}'.format(description), delay=0):
                reply(comment)
                # Give reddit time to process the submission
                time.sleep(2.0)

            if self.term.loader.exception is None:
                self.reload_page()
            else:
                raise TemporaryFileError()