code: def require(divisions, parts, required=None):
      """Clear out divisions where required components are not present
  
      In left, right, or inner joins we exclude portions of the dataset if one
      side or the other is not present.  We can achieve this at the partition
      level as well
  
      >>> divisions = [1, 3, 5, 7, 9]
      >>> parts = [(('a', 0), None),
      ...          (('a', 1), ('b', 0)),
      ...          (('a', 2), ('b', 1)),
      ...          (None, ('b', 2))]
  
      >>> divisions2, parts2 = require(divisions, parts, required=[0])
      >>> divisions2
      (1, 3, 5, 7)
      >>> parts2  # doctest: +NORMALIZE_WHITESPACE
      ((('a', 0), None),
       (('a', 1), ('b', 0)),
       (('a', 2), ('b', 1)))
  
      >>> divisions2, parts2 = require(divisions, parts, required=[1])
      >>> divisions2
      (3, 5, 7, 9)
      >>> parts2  # doctest: +NORMALIZE_WHITESPACE
      ((('a', 1), ('b', 0)),
       (('a', 2), ('b', 1)),
       (None, ('b', 2)))
  
      >>> divisions2, parts2 = require(divisions, parts, required=[0, 1])
      >>> divisions2
      (3, 5, 7)
      >>> parts2  # doctest: +NORMALIZE_WHITESPACE
      ((('a', 1), ('b', 0)),
       (('a', 2), ('b', 1)))
      """
      if not required:
          return divisions, parts
      for i in required:
          present = [j for j, p in enumerate(parts) if p[i] is not None]
          divisions = tuple(divisions[min(present) : max(present) + 2])
          parts = tuple(parts[min(present) : max(present) + 1])
      return divisions, parts
  
imports: from __future__ import annotations
  import math
  import pickle
  import warnings
  from functools import partial, wraps
  import numpy
  import pandas
  from pandas.api.types import is_dtype_equal
  from tlz import merge_sorted, unique
  from dask.base import is_dask_collection, tokenize
  from dask.dataframe import methods
  from dask.dataframe.core import DataFrame, Index, Series, _concat, _deprecated_kwarg, _Frame, _maybe_from_pandas, is_broadcastable, map_partitions, new_dd_object, prefix_reduction, suffix_reduction
  from dask.dataframe.dispatch import group_split_dispatch, hash_object_dispatch
  from dask.dataframe.io import from_pandas
  from dask.dataframe.shuffle import partitioning_index, rearrange_by_divisions, shuffle, shuffle_group
  from dask.dataframe.utils import asciitable, check_meta, is_dataframe_like, is_series_like, make_meta, strip_unknown_categories
  from dask.highlevelgraph import HighLevelGraph
  from dask.layers import BroadcastJoinLayer
  from dask.utils import M, apply, get_default_shuffle_method
label_desc: Use image node_id 3 for calling a global function with example usage: require(divisions, parts, required) and returns: divisions,  parts, divisions,  parts