code: def calculate_valid_score(valid_result, valid_metric=None):
      r"""return valid score from valid result
  
      Args:
          valid_result (dict): valid result
          valid_metric (str, optional): the selected metric in valid result for valid score
  
      Returns:
          float: valid score
      """
      if valid_metric:
          return valid_result[valid_metric]
      else:
          return valid_result["Recall@10"]
  
imports: import datetime
  import importlib
  import os
  import random
  import pandas
  import numpy
  import torch
  import torch.nn
  from torch.utils.tensorboard import SummaryWriter
  from texttable import Texttable
  from recbole.utils.enum_type import ModelType
label_desc: Use image node_id 6 for calling a global function with example usage: calculate_valid_score(valid_result, valid_metric) and returns: valid_result, valid_result