code: def resource_to_bytes(resource_str):
      if not resource_str:
          return resource_str
      matched = re.compile("([0-9]+)([a-z]+)?").match(
          resource_str.lower()
      )
      fraction_matched = re.compile("([0-9]+\\.[0-9]+)([a-z]+)?").match(
          resource_str.lower()
      )
      if fraction_matched:
          raise Exception(
              "Fractional values are not supported. Input was: {}".format(
                  resource_str
              )
          )
      try:
          value = int(matched.group(1))
          postfix = matched.group(2)
          if postfix == "b":
              value = value
          elif postfix == "k":
              value = value * 1000
          elif postfix == "m":
              value = value * 1000 * 1000
          elif postfix == "g":
              value = value * 1000 * 1000 * 1000
          else:
              raise Exception(
                  "Not supported type: {}".format(resource_str)
              )
          return value
      except Exception:
          raise Exception(
              "Size must be specified as bytes(b),"
              "kilobytes(k), megabytes(m), gigabytes(g). "
              "E.g. 50b, 100k, 250m, 30g"
          )
  
imports: import re
label_desc: Use image node_id 2 for calling a global function with example usage: resource_to_bytes(resource_str) and returns: resource_str, value