parameters: (exc, prefix="error: ")
return_statement: return error
docstring: Generate a useful error message from an EnvironmentError (IOError or
      OSError) exception object.  Handles Python 1.5.1 and 1.5.2 styles, and
      does what it can to deal with exception objects that don't have a
      filename (which happens when the error is due to a two-file operation,
      such as 'rename()' or 'link()'.  Returns the error message as a string
      prefixed with 'prefix'.
docstring_summary: Generate a useful error message from an EnvironmentError (IOError or
      OSError) exception object.  Handles Python 1.5.1 and 1.5.2 styles, and
      does what it can to deal with exception objects that don't have a
      filename (which happens when the error is due to a two-file operation,
      such as 'rename()' or 'link()'.  Returns the error message as a string
      prefixed with 'prefix'.
docstring_tokens: Generate a useful error message from an EnvironmentError ( IOError or OSError ) exception object . Handles Python 1 . 5 . 1 and 1 . 5 . 2 styles and does what it can to deal with exception objects that don t have a filename ( which happens when the error is due to a two - file operation such as rename () or link () . Returns the error message as a string prefixed with prefix .
function: def grok_environment_error (exc, prefix="error: "):
      """Generate a useful error message from an EnvironmentError (IOError or
      OSError) exception object.  Handles Python 1.5.1 and 1.5.2 styles, and
      does what it can to deal with exception objects that don't have a
      filename (which happens when the error is due to a two-file operation,
      such as 'rename()' or 'link()'.  Returns the error message as a string
      prefixed with 'prefix'.
      """
      # check for Python 1.5.2-style {IO,OS}Error exception objects
      if hasattr(exc, 'filename') and hasattr(exc, 'strerror'):
          if exc.filename:
              error = prefix + "%s: %s" % (exc.filename, exc.strerror)
          else:
              # two-argument functions in posix module don't
              # include the filename in the exception object!
              error = prefix + "%s" % exc.strerror
      else:
          error = prefix + str(exc[-1])
  
      return error
function_tokens: def grok_environment_error ( exc , prefix = "error: " ) : # check for Python 1.5.2-style {IO,OS}Error exception objects if hasattr ( exc , 'filename' ) and hasattr ( exc , 'strerror' ) : if exc . filename : error = prefix + "%s: %s" % ( exc . filename , exc . strerror ) else : # two-argument functions in posix module don't # include the filename in the exception object! error = prefix + "%s" % exc . strerror else : error = prefix + str ( exc [ - 1 ] ) return error