code: def encodeBinaryData(dataArray, bitEncoding, compression):
      
      #TODO: should raise an error if a wrong compression is specified
      arrayLength = len(dataArray)
      floattype, __ = interpretBitEncoding(bitEncoding)
      fmt = '{endian}{arraylength}{floattype}'.format(endian='<',
                                                      arraylength=arrayLength,
                                                      floattype=floattype
                                                      )
      packedData = PACK(fmt, *dataArray)
  
      if compression == 'zlib':
          compressedData = zlib.compress(packedData)
      else:
          compressedData = packedData
  
      encodedData = B64ENC(compressedData)
      return encodedData, arrayLength
docs: Function to encode a ``numpy.array`` into a mzML byte array. This is the
      inverse function of :func:`decodeBinaryData`.
  
      :param dataArray: #TODO: docstring
      :param bitEncoding: #TODO: docstring
      :param compression: #TODO: docstring
  
      :returns: #TODO: docstring