def _set_souma_id(app):
    """ Sets the SOUMA_ID of the local souma in the configuration of app.

    Loads (or creates and loades) the secret key of the local souma and uses it
    to set the id of the local souma.

    Args:
        app: A flask app
    """

    # Load/set secret key
    try:
        with open(app.config["SECRET_KEY_FILE"], 'rb') as f:
            app.config['SECRET_KEY'] = f.read(24)
    except __HOLE__:
        # Create new secret key
        app.logger.debug("Creating new secret key")
        app.config['SECRET_KEY'] = os.urandom(24)
        with open(app.config["SECRET_KEY_FILE"], 'wb') as f:
            os.chmod(app.config["SECRET_KEY_FILE"], 0700)
            f.write(app.config['SECRET_KEY'])

    # Generate ID used to identify this machine
    app.config['SOUMA_ID'] = SHA256.new(app.config['SECRET_KEY'] + str(app.config['LOCAL_PORT'])).hexdigest()[:32]
dataset/ETHPy150Open ciex/souma/nucleus/helpers.py/_set_souma_id