docs: def gen_binary(table, output, ascii_props=False, append=False, prefix=""):
      """Generate binary properties."""
  
      categories = []
      binary_props = (
          ('DerivedCoreProperties.txt', None),
          ('PropList.txt', None),
          ('DerivedNormalizationProps.txt', ('Changes_When_NFKC_Casefolded', 'Full_Composition_Exclusion'))
      )
      binary = {}
      for filename, include in binary_props:
          with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, filename), 'r', 'utf-8') as uf:
              for line in uf:
                  if not line.startswith('#'):
                      data = line.split('#')[0].split(';')
                      if len(data) < 2:
                          continue
                      if include and data[1].strip() not in include:
                          continue
                      span = create_span([int(i, 16) for i in data[0].strip().split('..')], is_bytes=ascii_props)
                      name = format_name(data[1])
  
                      if name not in binary:
                          binary[name] = []
                          categories.append(name)
                      if span is None:
                          continue
                      binary[name].extend(span)
  
      with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'CompositionExclusions.txt'), 'r', 'utf-8') as uf:
          name = 'compositionexclusion'
          for line in uf:
              if not line.startswith('#'):
                  data = [x.strip() for x in line.split('#')[0] if x.strip()]
                  if not data:
                      continue
                  span = create_span([int(data[0], 16)], is_bytes=ascii_props)
                  if span is None:
                      continue
  
                  if name not in binary:
                      binary[name] = []
                      categories.append(name)
                  binary[name].extend(span)
                  binary['full' + name].extend(span)
  
      with codecs.open(os.path.join(HOME, 'unicodedata', UNIVERSION, 'UnicodeData.txt'), 'r', 'utf-8') as uf:
          name = 'bidimirrored'
          for line in uf:
              data = line.strip().split(';')
              if data:
                  if data[9].strip().lower() != 'y':
                      continue
                  span = create_span([int(data[0].strip(), 16)], is_bytes=ascii_props)
                  if span is None:
                      continue
  
                  if name not in binary:
                      binary[name] = []
                      categories.append(name)
                  binary[name].extend(span)
  
      for name in list(binary.keys()):
          s = set(binary[name])
          binary[name] = sorted(s)
  
      gen_uposix(table, binary)
  
      # Convert characters values to ranges
      char2range(binary, is_bytes=ascii_props)
  
      with codecs.open(output, 'a' if append else 'w', 'utf-8') as f:
          if not append:
              f.write(HEADER)
          # Write out the Unicode properties
          f.write('%s_binary = {\n' % prefix)
          count = len(binary) - 1
          i = 0
          for k1, v1 in sorted(binary.items()):
              f.write('    "%s": "%s"' % (k1, v1))
              if i == count:
                  f.write('\n}\n')
              else:
                  f.write(',\n')
              i += 1
  
      return categories[:]