def create(self, archive, interval=None, **import_args):
        archive = archive.lower() if hasattr(archive, "lower") else archive
        if self.is_sync_table(archive, interval, **import_args):
            manager = SyncTableJobManager(self.client)
        else:
            manager = FileImportJobManager(self.client)
        import_job = manager.create(archive) if interval is None \
            else manager.create(archive, interval)
        import_job.run(**import_args)
        if import_job.get_id() is None:
            raise CartoException(_("Import API returned corrupt job details \
                                   when creating dataset"))
        import_job.refresh()
        count = 0
        while import_job.state in ("enqueued", "queued", "pending", "uploading",
                                   "unpacking", "importing", "guessing") \
            or (isinstance(manager, SyncTableJobManager)
                and import_job.state == "created"):
            if count >= MAX_NUMBER_OF_RETRIES:
                raise CartoException(_("Maximum number of retries exceeded \
                                       when polling the import API for \
                                       dataset creation"))
            time.sleep(INTERVAL_BETWEEN_RETRIES_S)
            import_job.refresh()
            count += 1
        if import_job.state == "failure":
            raise CartoException(_("Dataset creation was not successful \
                                   because of failed import (error: {error}")
                                 .format(error=json.dumps(
                                     import_job.get_error_text)))
        if (import_job.state != "complete" and import_job.state != "created"
            and import_job.state != "success") \
                or import_job.success is False:
            raise CartoException(_("Dataset creation was not successful \
                                   because of unknown import error"))
        if hasattr(import_job, "visualization_id") \
                and import_job.visualization_id is not None:
            visualization_id = import_job.visualization_id
        else:
            table = TableManager(self.client).get(import_job.table_id)
            visualization_id = table.table_visualization.get_id() \
                if table is not None else None
        try:
            return self.get(visualization_id) if visualization_id is not None \
                else None
        except AttributeError:
            raise CartoException(_("Dataset creation was not successful \
                                   because of unknown error"))