code: def get_context_layoutlm(document, dpi_norm):
      context = []
      for page in document:
          for token in page["tokens"]:
              pos = token["position"]
              offset = token["doc_offset"]
              width = page["pages"][0]["size"]["width"]
              height = page["pages"][0]["size"]["height"]
              context.append(
                  {
                      "top": int(pos["top"] / height * 1000),
                      "bottom": int(pos["bottom"] / height * 1000),
                      "left": int(pos["left"] / width * 1000),
                      "right": int(pos["right"] / width * 1000),
                      "start": offset["start"],
                      "end": offset["end"],
                      "text": token["text"],
                  }
              )
      return context
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_context_layoutlm(document, dpi_norm) and returns: context