code: def get_weight(keypoints, mask=None, ng_w=0.01, ps_w=1.0):
      is_background = tf.equal(keypoints, 0)
      ones = tf.to_float(tf.ones_like(is_background))
      weights = tf.where(is_background, ones * ng_w, ones * ps_w)
      # if mask is not None:
      #     weights *= tf.to_float(mask)
  
      return weights
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import menpo.io
  from menpo.image import Image
  from menpo.shape import PointCloud
  import cv2
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.contrib.framework.python.ops import variables
  from tensorflow.python.training import optimizer
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
  from menpo.transform import Translation, Scale
  from menpo.shape import PointCloud
label_desc: Use image node_id 12 for calling a global function with example usage: get_weight(keypoints, mask, ng_w, ps_w) and returns: weights