code: def newsample(news, ratio):
      """Sample ratio samples from news list.
      If length of news is less than ratio, pad zeros.
  
      Args:
          news (list): input news list
          ratio (int): sample number
  
      Returns:
          list: output of sample list.
      """
      if ratio > len(news):
          return news + [0] * (ratio - len(news))
      else:
          return random.sample(news, ratio)
  
file_path: recommenders/recommenders/models/newsrec/newsrec_utils.py
imports: from recommenders.models.deeprec.deeprec_utils import flat_config, HParams, load_yaml
  import random
  import re
label_desc: Use image node_id 6 for calling a global function with example usage: newsample(news, ratio) and returns: unknown, random