
def visualize(flow, old_state, new_state, filename="node_state"):
    """
    Flow state handler that stores the current flow
    visualization to a known file location, for live viewing.
    """
    if isinstance(new_state.result, dict):
        ## note that the relevant file will actually be called "known_location.pdf"
        flow.visualize(flow_state=new_state, filename=filename)
    return new_state

node_artifact_dir = "'s3://bucketname/xyz_key/'
node_flow.visualize(flow_state=flow_state, filename=f"{node_artifact_dir}make_node_{unique_node_id}")
