<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def strip_praw_submission(cls, sub):
 """ Parse through a submission and return a dict with data ready to be displayed through the terminal. Definitions: permalink - URL to the reddit page with submission comments. url_full - URL that the submission points to. url - URL that will be displayed on the subreddit page, may be "selfpost", "x-post submission", "x-post subreddit", or an external link. """


        reddit_link = re.compile(
            r'https?://(www\.)?(np\.)?redd(it\.com|\.it)/r/.*')
        author = getattr(sub, 'author', '[deleted]')
        name = getattr(author, 'name', '[deleted]')
        flair = getattr(sub, 'link_flair_text', '')

        data = {}
        data['object'] = sub
        data['type'] = 'Submission'
        data['title'] = sub.title
        data['text'] = sub.selftext
        data['html'] = sub.selftext_html or ''
        data['created'] = cls.humanize_timestamp(sub.created_utc)
        data['created_long'] = cls.humanize_timestamp(sub.created_utc, True)
        data['comments'] = '{0} comments'.format(sub.num_comments)
        data['score'] = '{0} pts'.format('-' if sub.hide_score else sub.score)
        data['author'] = name
        data['permalink'] = sub.permalink
        data['subreddit'] = six.text_type(sub.subreddit)
        data['flair'] = '[{0}]'.format(flair.strip(' []')) if flair else ''
        data['url_full'] = sub.url
        data['likes'] = sub.likes
        data['gold'] = sub.gilded
        data['nsfw'] = sub.over_18
        data['stickied'] = sub.stickied
        data['hidden'] = sub.hidden
        data['xpost_subreddit'] = None
        data['index'] = None  # This is filled in later by the method caller
        data['saved'] = sub.saved
        if sub.edited:
            data['edited'] = '(edit {})'.format(
                cls.humanize_timestamp(sub.edited))
            data['edited_long'] = '(edit {})'.format(
                cls.humanize_timestamp(sub.edited, True))
        else:
            data['edited'] = ''
            data['edited_long'] = ''

        if sub.url.split('/r/')[-1] == sub.permalink.split('/r/')[-1]:
            data['url'] = 'self.{0}'.format(data['subreddit'])
            data['url_type'] = 'selfpost'
        elif reddit_link.match(sub.url):
            # Strip the subreddit name from the permalink to avoid having
            # submission.subreddit.url make a separate API call
            url_parts = sub.url.split('/')
            data['xpost_subreddit'] = url_parts[4]
            data['url'] = 'self.{0}'.format(url_parts[4])
            if 'comments' in url_parts:
                data['url_type'] = 'x-post submission'
            else:
                data['url_type'] = 'x-post subreddit'
        else:
            data['url'] = sub.url
            data['url_type'] = 'external'

        return data