<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_file_to_descriptor(input_queue, descriptor):
 """ get item from input_queue and write it to descriptor returns True if and only if it was successfully written """

    try:
        file_name = input_queue.get(timeout=2)
        descriptor.write("{}\n".format(file_name))
        descriptor.flush()
        input_queue.task_done()
        return True
    except Empty:
        # no more files in queue
        descriptor.close()
        return False
    except IOError:
        return False