code: def is_split_before_delimiter(
      leaf: Leaf, previous: Optional[Leaf] = None
  ) -> Priority:
      """Return the priority of the `leaf` delimiter, given a line break before it.
  
      The delimiter priorities returned here are from those delimiters that would
      cause a line break before themselves.
  
      Higher numbers are higher priority.
      """
      if is_vararg(leaf, within=VARARGS_PARENTS | UNPACKING_PARENTS):
          # * and ** might also be MATH_OPERATORS but in this case they are not.
          # Don't treat them as a delimiter.
          return 0
  
      if (
          leaf.type == token.DOT
          and leaf.parent
          and leaf.parent.type
          not in {syms.import_from, syms.dotted_name}
          and (previous is None or previous.type in CLOSING_BRACKETS)
      ):
          return DOT_PRIORITY
  
      if (
          leaf.type in MATH_OPERATORS
          and leaf.parent
          and leaf.parent.type not in {syms.factor, syms.star_expr}
      ):
          return MATH_PRIORITIES[leaf.type]
  
      if leaf.type in COMPARATORS:
          return COMPARATOR_PRIORITY
  
      if (
          leaf.type == token.STRING
          and previous is not None
          and previous.type == token.STRING
      ):
          return STRING_PRIORITY
  
      if leaf.type not in {token.NAME, token.ASYNC}:
          return 0
  
      if (
          leaf.value == "for"
          and leaf.parent
          and leaf.parent.type in {syms.comp_for, syms.old_comp_for}
          or leaf.type == token.ASYNC
      ):
          if (
              not isinstance(leaf.prev_sibling, Leaf)
              or leaf.prev_sibling.value != "async"
          ):
              return COMPREHENSION_PRIORITY
  
      if (
          leaf.value == "if"
          and leaf.parent
          and leaf.parent.type in {syms.comp_if, syms.old_comp_if}
      ):
          return COMPREHENSION_PRIORITY
  
      if (
          leaf.value in {"if", "else"}
          and leaf.parent
          and leaf.parent.type == syms.test
      ):
          return TERNARY_PRIORITY
  
      if leaf.value == "is":
          return COMPARATOR_PRIORITY
  
      if (
          leaf.value == "in"
          and leaf.parent
          and leaf.parent.type in {syms.comp_op, syms.comparison}
          and not (
              previous is not None
              and previous.type == token.NAME
              and previous.value == "not"
          )
      ):
          return COMPARATOR_PRIORITY
  
      if (
          leaf.value == "not"
          and leaf.parent
          and leaf.parent.type == syms.comp_op
          and not (
              previous is not None
              and previous.type == token.NAME
              and previous.value == "is"
          )
      ):
          return COMPARATOR_PRIORITY
  
      if leaf.value in LOGIC_OPERATORS and leaf.parent:
          return LOGIC_PRIORITY
  
      return 0
  
imports: from dataclasses import dataclass, field
  from typing import Dict, Final, Iterable, List, Optional, Sequence, Set, Tuple, Union
  from black.nodes import BRACKET, CLOSING_BRACKETS, COMPARATORS, LOGIC_OPERATORS, MATH_OPERATORS, OPENING_BRACKETS, UNPACKING_PARENTS, VARARGS_PARENTS, is_vararg, syms
  from blib2to3.pgen2 import token
  from blib2to3.pytree import Leaf, Node
label_desc: Use image node_id 2 for calling a global function with example usage: is_split_before_delimiter(leaf, previous) and returns: int, int, DOT_PRIORITY, MATH_PRIORITIES, COMPARATOR_PRIORITY, STRING_PRIORITY, int, COMPREHENSION_PRIORITY, TERNARY_PRIORITY, COMPARATOR_PRIORITY, COMPARATOR_PRIORITY, COMPARATOR_PRIORITY, LOGIC_PRIORITY, COMPREHENSION_PRIORITY