This statement is just trying to catch file objects, and ideally I don't think it should catch anything else as ``HDUList`` and other types are already recognized, so I'm not sure I understand your suggestions. Aren't all file-like objects guaranteed to have at least a ``read`` attribute?