code: def get_valid_input(session, valid_file_path):
      """Generate validation file.
  
      Args:
          session (list): List of user session with user_id, clicks, positive and negative interactions.
          valid_file_path (str): Path to file.
      """
      fp_valid = open(valid_file_path, "w", encoding="utf-8")
      for sess_id in range(len(session)):
          userid, _, poss, negs = session[sess_id]
          for i in range(len(poss)):
              fp_valid.write(
                  "1 "
                  + "valid_"
                  + userid
                  + " "
                  + poss[i]
                  + "%"
                  + str(sess_id)
                  + "\n"
              )
          for i in range(len(negs)):
              fp_valid.write(
                  "0 "
                  + "valid_"
                  + userid
                  + " "
                  + negs[i]
                  + "%"
                  + str(sess_id)
                  + "\n"
              )
      fp_valid.close()
      if os.path.isfile(valid_file_path):
          logger.info(
              f"Validation file {valid_file_path} successfully generated"
          )
      else:
          raise FileNotFoundError(
              f"Error when generating {valid_file_path}"
          )
  
imports: import os
  import random
  import logging
  import json
  import numpy
  import re
  from tqdm import tqdm
  from nltk.tokenize import RegexpTokenizer
  from recommenders.datasets.download_utils import maybe_download, download_path, unzip_file
label_desc: Use image node_id 6 for calling a global function with example usage: get_valid_input(session, valid_file_path) without return types