def _open_if_needed(handle):
if isinstance(handle, ContextStringIO):<EOL><INDENT>return handle<EOL><DEDENT>return open(handle)<EOL>
Return handle if it is a ContextStringIO instance else try to open it.