code: def to_packed(self, boundscheck=True):
          
  
          check_ploidy(self.ploidy, 2)
  
          if boundscheck:
              amx = self.max()
              if amx > 14:
                  raise ValueError('max allele for packing is 14, found %s' % amx)
              amn = self.min()
              if amn < -1:
                  raise ValueError('min allele for packing is -1, found %s' % amn)
  
          # pack data
          values = memoryview_safe(self.values)
          packed = genotype_array_pack_diploid(values)
  
          return packed
docs: Pack diploid genotypes into a single byte for each genotype,
          using the left-most 4 bits for the first allele and the right-most 4
          bits for the second allele. Allows single byte encoding of diploid
          genotypes for variants with up to 15 alleles.
  
          Parameters
          ----------
          boundscheck : bool, optional
              If False, do not check that minimum and maximum alleles are
              compatible with bit-packing.
  
          Returns
          -------
          packed : ndarray, uint8, shape (n_variants, n_samples)
              Bit-packed genotype array.
  
          Notes
          -----
          If a mask has been set, it is ignored by this function.
  
          Examples
          --------
  
          >>> import allel
          >>> g = allel.GenotypeArray([[[0, 0], [0, 1]],
          ...                          [[0, 2], [1, 1]],
          ...                          [[2, 2], [-1, -1]]], dtype='i1')
          >>> g.to_packed()
          array([[  0,   1],
                 [  2,  17],
                 [ 34, 239]], dtype=uint8)