docs: def table_present(name, db, schema, force=False):
      '''
      Make sure the specified table exists with the specified schema
  
      name
          The name of the table
  
      db
          The name of the database file
  
      schema
          The dictionary containing the schema information
  
      force
          If the name of the table exists and force is set to False,
          the state will fail.  If force is set to True, the existing
          table will be replaced with the new table
      '''
      changes = {'name': name,
                 'changes': {},
                 'result': None,
                 'comment': ''}
      conn = None
      try:
          conn = sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES)
          tables = _query(conn,
                          "SELECT sql FROM sqlite_master " +
                          "WHERE type='table' AND name=?", [name])
  
          if len(tables) == 1:
              sql = None
              if isinstance(schema, six.string_types):
                  sql = schema.strip()
              else:
                  sql = _get_sql_from_schema(name, schema)
  
              if sql != tables[0][0]:
                  if force:
                      if __opts__['test']:
                          changes['result'] = True
                          changes['changes']['old'] = tables[0][0]
                          changes['changes']['new'] = sql
                          changes['comment'] = "'" + name + "' will be replaced"
                      else:
                          conn.execute("DROP TABLE `" + name + "`")
                          conn.execute(sql)
                          conn.commit()
                          changes['result'] = True
                          changes['changes']['old'] = tables[0][0]
                          changes['changes']['new'] = sql
                          changes['comment'] = "Replaced '" + name + "'"
                  else:
                      changes['result'] = False
                      changes['comment'] = "Expected schema=" + sql + \
                                           "\nactual schema=" + tables[0][0]
              else:
                  changes['result'] = True
                  changes['comment'] = "'" + name + \
                                       "' exists with matching schema"
          elif not tables:
              # Create the table
              sql = None
              if isinstance(schema, six.string_types):
                  sql = schema
              else:
                  sql = _get_sql_from_schema(name, schema)
              if __opts__['test']:
                  changes['result'] = True
                  changes['changes']['new'] = sql
                  changes['comment'] = "'" + name + "' will be created"
              else:
                  conn.execute(sql)
                  conn.commit()
                  changes['result'] = True
                  changes['changes']['new'] = sql
                  changes['comment'] = "Created table '" + name + "'"
          else:
              changes['result'] = False
              changes['comment'] = 'Multiple tables with the same name=' + name
  
      except Exception as e:
          changes['result'] = False
          changes['comment'] = str(e)
  
      finally:
          if conn:
              conn.close()
  
      return changes