def _load_script(self, filename: str) -> Script:
        """Load a Lua script.

        Read the Lua script file to generate its Script object. If the script
        starts with a magic string, add it to the list of scripts requiring an
        idempotency token to execute.
        """
        with open(path.join(here, 'redis_scripts', filename), mode='rb') as f:
            script_data = f.read()
        rv = self._r.register_script(script_data)
        if script_data.startswith(b'-- idempotency protected script'):
            self._idempotency_protected_scripts.append(rv)
        return rv
Load a Lua script.

        Read the Lua script file to generate its Script object. If the script
        starts with a magic string, add it to the list of scripts requiring an
        idempotency token to execute.