def openFD(fd):
if type(fd).__name__ == "<STR_LIT:str>":<EOL><INDENT>return open(fd)<EOL><DEDENT>if type(fd).__name__ == "<STR_LIT:file>":<EOL><INDENT>return open(fd.name)<EOL><DEDENT>if type(fd).__name__ == "<STR_LIT>":<EOL><INDENT>return fd<EOL><DEDENT>nfd = copy(fd)<EOL>nfd.reset()<EOL>return nfd<EOL>
@summary: given a descriptor for a file (e.g. path or file stream), will
          attempt to return a new stream for the file ready to be read
          from the beginning
@param fd: the file descriptor to open a stream to
@raise IOError: if a new stream reset to the begining of the file cannot
                be constructed