parameters: (file, context, namespaces=True)
return_statement: return result
docstring: Parse a fragment of a document, given the context from which it
      was originally extracted.  context should be the parent of the
      node(s) which are in the fragment.
  
      'file' may be either a file name or an open file object.
docstring_summary: Parse a fragment of a document, given the context from which it
      was originally extracted.  context should be the parent of the
      node(s) which are in the fragment.
docstring_tokens: Parse a fragment of a document given the context from which it was originally extracted . context should be the parent of the node ( s ) which are in the fragment .
function: def parseFragment(file, context, namespaces=True):
      """Parse a fragment of a document, given the context from which it
      was originally extracted.  context should be the parent of the
      node(s) which are in the fragment.
  
      'file' may be either a file name or an open file object.
      """
      if namespaces:
          builder = FragmentBuilderNS(context)
      else:
          builder = FragmentBuilder(context)
  
      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 parseFragment ( file , context , namespaces = True ) : if namespaces : builder = FragmentBuilderNS ( context ) else : builder = FragmentBuilder ( context ) if isinstance ( file , StringTypes ) : fp = open ( file , 'rb' ) try : result = builder . parseFile ( fp ) finally : fp . close ( ) else : result = builder . parseFile ( file ) return result