def METHOD_NAME(cls, file_path: str, compression_type: str = "gzip") -> str:
    """
    Compress the file at `file_path` with `gzip` or `bzip2`.
    :param file_path: The path to file to compress.
    :param compression_type: The one of compression types.
    :returns: The path to created archive.
    :raises Exception: When `compression_type` is invalid.
    :raises RuntimeError: When the compression process fails.
    """
    if compression_type not in _COMPRESSION_TYPES:
        raise Exception(
            (
                f'The "{compression_type}" compression is not supported. '
                f"Use one of {cls._quote_items(_COMPRESSION_TYPES.keys())}."
            )
        )
    arguments, file_extension = _COMPRESSION_TYPES[compression_type]
    archive_path = f"{file_path}.{file_extension}"
    cls._subprocess(
        [*arguments, file_path],
        f'Failed to compress "{file_path}" using "{compression_type}".',
    )
    return archive_path