parameters: (file, namespaces=True)
return_statement: return result
docstring: Parse a document, returning the resulting Document node.
  
      'file' may be either a file name or an open file object.
docstring_summary: Parse a document, returning the resulting Document node.
docstring_tokens: Parse a document returning the resulting Document node .
function: def parse(file, namespaces=True):
      """Parse a document, returning the resulting Document node.
  
      'file' may be either a file name or an open file object.
      """
      if namespaces:
          builder = ExpatBuilderNS()
      else:
          builder = ExpatBuilder()
  
      if isinstance(file, StringTypes):
          fp = open(file, 'rb')
          try:
              result = builder.parseFile(fp)
          finally:
              fp.close()
      else:
          result = builder.parseFile(file)
      return result
function_tokens: def parse ( file , namespaces = True ) : if namespaces : builder = ExpatBuilderNS ( ) else : builder = ExpatBuilder ( ) if isinstance ( file , StringTypes ) : fp = open ( file , 'rb' ) try : result = builder . parseFile ( fp ) finally : fp . close ( ) else : result = builder . parseFile ( file ) return result