def is_task_created(tasks, info_hash, is_directory=True):
    """
    Check if a task is created against a hash value

    :param list tasks: a list of :class:`API.Task` objects
    :param str info_hash: hash value of the target task
    :param bool is_directory: whether this task has an associated directory

    """
    for task in tasks:
        if task.info_hash == info_hash:
            assert task.is_directory == is_directory
            return True
    else:
        return False