def get_errno(exc):
try:<EOL><INDENT>return exc.errno<EOL><DEDENT>except AttributeError:<EOL><INDENT>try:<EOL><INDENT>if isinstance(exc.args, tuple) and len(exc.args) == <NUM_LIT:2>:<EOL><INDENT>return exc.args[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return <NUM_LIT:0><EOL>
:exc:`socket.error` and :exc:`IOError` first got
    the ``.errno`` attribute in Py2.7