def run(self, edit, format=None, tz_in=None, tz_out=None):
        if format is not None:
            if format == '' or not isinstance(format, basestring) or format.isspace():
                # Not a string, empty or only whitespaces
                return

        # Do the actual parse action
        try:
            text = fdate.parse(format, tz_in, tz_out)
        except UnknownTimeZoneError as e:
            status(str(e).strip('"'), e)
            return
        except Exception as e:
            status("Error parsing format string `%s`" % format, e)
            return

        # Don't bother replacing selections with actually nothing
        if not text or text.isspace():
            return

        # Do replacements
        for r in self.view.sel():
            # Insert when sel is empty to not select the contents
            if r.empty():
                self.view.insert(edit, r.a, text)
            else:
                self.view.replace(edit, r, text)
dataset/ETHPy150Open FichteFoll/InsertDate/insert_date.py/InsertDateCommand.run/original