Writes the first element of the inbox to the provided stream (file handle) 
    delimiting the input by the optional delimiter string. Returns the name of
    the file being written. 
    
    Note that only a single process can have access to a file handle open for 
    writing. Therefore this function should only be used by a non-parallel 
    ``Piper``.

    Arguments:

      - handle(``file``) File handle open for writing.
      - delimiter(``str``) [default: ``None``] A string which will seperate the
        written items. e.g: ``"END"`` becomes ``"\\nEND\\n"`` in the output 
        stream. The default is an empty string which means that items will be 
        seperated by a blank line i.e.: ``"\\n\\n"`` (two new-line characters).

def dump_stream(inbox, handle, delimiter=None):
    """
    Writes the first element of the inbox to the provided stream (file handle) 
    delimiting the input by the optional delimiter string. Returns the name of
    the file being written. 
    
    Note that only a single process can have access to a file handle open for 
    writing. Therefore this function should only be used by a non-parallel 
    ``Piper``.

    Arguments:

      - handle(``file``) File handle open for writing.
      - delimiter(``str``) [default: ``None``] A string which will seperate the
        written items. e.g: ``"END"`` becomes ``"\\nEND\\n"`` in the output 
        stream. The default is an empty string which means that items will be 
        seperated by a blank line i.e.: ``"\\n\\n"`` (two new-line characters).
        
    """
    handle.write(inbox[0])
    delimiter = '\n%s\n' % (delimiter or '')
    handle.write(delimiter)