from pathlib import Path
import tempfile


def tmp_file(**kwargs) -> Path:
    """
    Creates NamedTemporaryFile and returns associated pathlib.Path
    :param kwargs: NamedTemporaryFile arguments
    :return: pathlib.Path(temp_file)
    """
    kwargs['delete'] = kwargs.get('delete', False)
    return Path(tempfile.NamedTemporaryFile(**kwargs).name)