<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def execute_command(self, command, tab=None):
 # TODO DBUS_ONLY """Execute the `command' in the `tab'. If tab is None, the command will be executed in the currently selected tab. Command should end with '\n', otherwise it will be appended to the string. """

        # TODO CONTEXTMENU this has to be rewriten and only serves the
        # dbus interface, maybe this should be moved to dbusinterface.py
        if not self.get_notebook().has_page():
            self.add_tab()

        if command[-1] != '\n':
            command += '\n'

        terminal = self.get_notebook().get_current_terminal()
        terminal.feed_child(command)