      extension = os.path.splitext(filename)[1].lower()
      logger.debug("extension: '%s'", extension)
  
      if extension == ".json":
          return _JSONSerializer()
      if extension == ".p":
          return _PickleSerializer()
      if extension in (".yaml", ".yml") and yaml is not None:
          return _YAMLSerializer()
      if extension in (".yaml", ".yml") and yaml is None:
          logger.warning("You must have PyYAML installed to use YAML as the serializer.\n"
                         "Switching to JSON as the serializer.")
      logger.warning("Unrecognized extension: '%s'. Returning json serializer", extension)
      return _JSONSerializer()
 
</s> remove     logger.warning("Unrecognized extension: '%s'. Returning json serializer", extension)
    return _JSONSerializer()
 </s> add         retval = _JSONSerializer()
    else:
        logger.warning("Unrecognized extension: '%s'. Returning json serializer", extension)
        retval = _JSONSerializer()
    logger.debug(retval)
    return retval </s> remove     if serializer.lower() == "json":
        return _JSONSerializer()
    if serializer.lower() == "pickle":
        return _PickleSerializer()
    if serializer.lower() == "yaml" and yaml is not None:
        return _YAMLSerializer()
    if serializer.lower() == "yaml" and yaml is None:
 </s> add     if serializer.lower() == "npy":
        retval = _NPYSerializer()
    elif serializer.lower() == "compressed":
        retval = _CompressedSerializer()
    elif serializer.lower() == "json":
        retval = _JSONSerializer()
    elif serializer.lower() == "pickle":
        retval = _PickleSerializer()
    elif serializer.lower() == "yaml" and yaml is not None:
        retval = _YAMLSerializer()
    elif serializer.lower() == "yaml" and yaml is None: </s> remove     logger.warning("Unrecognized serializer: '%s'. Returning json serializer", serializer)
    return _JSONSerializer()
 </s> add         retval = _JSONSerializer
    else:
        logger.warning("Unrecognized serializer: '%s'. Returning json serializer", serializer)
    logger.debug(retval)
    return retval </s> remove         elif serializer not in ("json", "pickle", "yaml"):
            raise ValueError("Error: {} is not a valid serializer. Use "
                             "'json', 'pickle' or 'yaml'")
 </s> add  </s> remove             specified serializer will be used """
        logger.debug("Getting serializer: (filename: '%s', serializer: '%s')",
                     filename, serializer)
 </s> add             compressed pickle will be used """
        logger.debug("Getting serializer: (filename: '%s')", filename)
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
      extension = os.path.splitext(filename)[1].lower()
      logger.debug("extension: '%s'", extension)
  
      if extension == ".json":
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
          logger.warning("You must have PyYAML installed to use YAML as the serializer.\n"
                         "Switching to JSON as the serializer.")
      logger.warning("Unrecognized extension: '%s'. Returning json serializer", extension)
      return _JSONSerializer()
keep keep keep keep replace replace replace replace replace replace keep keep keep keep
 Serialize masks to alignments file

- Add new serializers (npy + compressed)
- Remove Serializer option from cli
- Revert get_aligned call in scripts/extract
- Default alignments to compressed
- Size masks to 128px and compress
- Remove mask thresholding/blur from generation code
- Add Mask class to lib/faces_detect
- Revert debug landmarks to aligned face
- Revert non-extraction code to staging version 
lib/serializer.py