def make_delete_func(name: str):
    """Returns a PidFile remove function of specified name,
    in order to have unique atexit registration"""
    # noinspection PyProtectedMember,PyBroadException
    def delete_func(pidfile_):
        # noinspection PyPep8
        try:
            pidfile_._remove()
        except:
            pass
    assert name.isidentifier()
    delete_func.__name__ = name
    return delete_func