def check_database():
    """
    Check so the database exists.

    Returns:
        exists (bool): `True` if the database exists, otherwise `False`.
    """
    # Check so a database exists and is accessible
    from django.db import connection
    tables = connection.introspection.get_table_list(connection.cursor())
    if not tables or not isinstance(tables[0], basestring): # django 1.8+
        tables = [tableinfo.name for tableinfo in tables]
    if tables and tables in u'players_playerdb':
        # database exists and seems set up. Initialize evennia.
        import evennia
        evennia._init()
    # Try to get Player#1
    from evennia.players.models import PlayerDB
    try:
        PlayerDB.objects.get(id=1)
    except django.db.utils.OperationalError as e:
        print(ERROR_DATABASE.format(traceback=e))
        sys.exit()
    except PlayerDB.DoesNotExist:
        # no superuser yet. We need to create it.

        other_superuser = PlayerDB.objects.filter(is_superuser=True)
        if other_superuser:
            # Another superuser was found, but not with id=1. This may
            # happen if using flush (the auto-id starts at a higher
            # value). Wwe copy this superuser into id=1. To do
            # this we must deepcopy it, delete it then save the copy
            # with the new id. This allows us to avoid the UNIQUE
            # constraint on usernames.
            other = other_superuser[0]
            other_id = other.id
            other_key = other.username
            print(WARNING_MOVING_SUPERUSER.format(
                other_key=other_key, other_id=other_id))
            res = ""
            while res.upper() != "Y":
                # ask for permission
                res = input("Continue [Y]/N: ")
                if res.upper() == "N":
                    sys.exit()
                elif not res:
                    break
            # continue with the
            from copy import deepcopy
            new = deepcopy(other)
            other.delete()
            new.id = 1
            new.save()
        else:
            create_superuser()
            check_database()
    return True
dataset/ETHPy150Open evennia/evennia/evennia/server/evennia_launcher.py/check_database/swapped operands of `in`