docs: def decode(image, timeout=None, gap_size=None, shrink=1, shape=None,
             deviation=None, threshold=None, min_edge=None, max_edge=None,
             corrections=None, max_count=None):
      """Decodes datamatrix barcodes in `image`.
  
      Args:
          image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
          timeout (int): milliseconds
          gap_size (int):
          shrink (int):
          shape (int):
          deviation (int):
          threshold (int):
          min_edge (int):
          max_edge (int):
          corrections (int):
          max_count (int): stop after reading this many barcodes. `None` to read
              as many as possible.
  
      Returns:
          :obj:`list` of :obj:`Decoded`: The values decoded from barcodes.
      """
      dmtx_timeout = None
      if timeout:
          now = dmtxTimeNow()
          dmtx_timeout = dmtxTimeAdd(now, timeout)
  
      if max_count is not None and max_count < 1:
          raise ValueError('Invalid max_count [{0}]'.format(max_count))
  
      pixels, width, height, bpp = _pixel_data(image)
  
      results = []
      with _image(
          cast(pixels, c_ubyte_p), width, height, _PACK_ORDER[bpp]
      ) as img:
          with _decoder(img, shrink) as decoder:
              properties = [
                  (DmtxProperty.DmtxPropScanGap, gap_size),
                  (DmtxProperty.DmtxPropSymbolSize, shape),
                  (DmtxProperty.DmtxPropSquareDevn, deviation),
                  (DmtxProperty.DmtxPropEdgeThresh, threshold),
                  (DmtxProperty.DmtxPropEdgeMin, min_edge),
                  (DmtxProperty.DmtxPropEdgeMax, max_edge)
              ]
  
              # Set only those properties with a non-None value
              for prop, value in ((p, v) for p, v in properties if v is not None):
                  dmtxDecodeSetProp(decoder, prop, value)
  
              if not corrections:
                  corrections = DmtxUndefined
  
              while True:
                  with _region(decoder, dmtx_timeout) as region:
                      # Finished file or ran out of time before finding another
                      # region
                      if not region:
                          break
                      else:
                          # Decoded
                          res = _decode_region(
                              decoder, region, corrections, shrink
                          )
                          if res:
                              results.append(res)
  
                              # Stop if we've reached maximum count
                              if max_count and len(results) == max_count:
                                  break
  
      return results