import io
import tarfile


def extract_tarbytes(file_bytes, path):
    """Extract tarfile as bytes.

    Args:
        file_bytes (bytearray): Bytes of file to extract
        path (str): Path to extract it to

    Returns:
        path: destination path

    """
    tar_bytes_obj = io.BytesIO(file_bytes)
    with tarfile.open(fileobj=tar_bytes_obj, mode="r:gz") as tar:
        tar.extractall(path)
    return path