code: def _binsplit(splittable, charset, maxlinelen):
      i = 0
      j = len(splittable)
      while i < j:
          # Invariants:
          # 1. splittable[:k] fits for all k <= i (note that we *assume*,
          #    at the start, that splittable[:0] fits).
          # 2. splittable[:k] does not fit for any k > j (at the start,
          #    this means we shouldn't look at any k > len(splittable)).
          # 3. We don't know about splittable[:k] for k in i+1..j.
          # 4. We want to set i to the largest k that fits, with i <= k <= j.
          #
          m = (i + j + 1) >> 1  # ceiling((i+j)/2); i < m <= j
          chunk = charset.from_splittable(splittable[:m], True)
          chunklen = charset.encoded_header_len(chunk)
          if chunklen <= maxlinelen:
              # m is acceptable, so is a new lower bound.
              i = m
          else:
              # m is not acceptable, so final i must be < m.
              j = m - 1
      # i == j.  Invariant #1 implies that splittable[:i] fits, and
      # invariant #2 implies that splittable[:i+1] does not fit, so i
      # is what we're looking for.
      first = charset.from_splittable(splittable[:i], False)
      last = charset.from_splittable(splittable[i:], False)
      return first, last
  
imports: import re
  import binascii
  import email.quoprimime
  import email.base64mime
  from email.errors import HeaderParseError
  from email.charset import Charset
label_desc: Use image node_id 4 for calling a global function with example usage: _binsplit(splittable, charset, maxlinelen) and returns: first,  last