why returning a file object when writing ? Is there a reason to return a different object than the one passed as argument ? If no, it does not make sense. the calling code already knows the file