<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def paste(self, tl_key, data, freq=None):
 """Pastes data into grid, marks grid changed If no selection is present, data is pasted starting with current cell If a selection is present, data is pasted fully if the selection is smaller. If the selection is larger then data is duplicated. Parameters ul_key: Tuple \key of top left cell of paste area data: iterable of iterables where inner iterable returns string \tThe outer iterable represents rows freq: Integer, defaults to None \tStatus message frequency """


        # Get selection bounding box

        selection = self.get_selection()

        # Mark content as changed
        post_command_event(self.main_window, self.ContentChangedMsg)

        if selection:
            # There is a selection.  Paste into it
            self.paste_to_selection(selection, data, freq=freq)
        else:
            # There is no selection.  Paste from top left cell.
            self.paste_to_current_cell(tl_key, data, freq=freq)