def xcopy(self, input=None):
    '''
    Converts the value of the input stream (or contents of input filename) 
    from xyaptu format to yaptu format, and invokes yaptu.copy
    '''
    
    # Read the input
    inf = input
    try: 
      inputText = inf.read()
    except AttributeError: 
      inf = open(input)
      if inf is None: 
        raise ValueError, "Can't open file (%s)" % input 
      inputText = inf.read()
    try:
      inf.close()
    except: 
      pass

    # Translate (xyaptu) input to (yaptu) input, and call yaptu.copy()
    from cStringIO import StringIO
    yinf = StringIO(self._x2y_translate(inputText))
    self.copy(inf=yinf)
    yinf.close()

    Converts the value of the input stream (or contents of input filename) 
    from xyaptu format to yaptu format, and invokes yaptu.copy
    
recipes/Python/162292_XYAPTU_Lightweight_XMLHTML_Document_Template/recipe-162292.py