@classmethod
def _get_file(cls, fp, close=None):
    """
            Returns a three-tuple:
            if fp is a filename:
            filename, filename, close
            or if fp is file-like object:
            filename, file, close
            where filename can be None
            Opening of the file is left to the actual parser class if a filename
            was passed. If a file is passed, care must be taken to ensure it is
            opened in the correct mode (the __file_mode__ attribute on the 
            actual parsers class called). Therefore, it is safer to pass
            filenames to a BaseGroupParser sub-class than it is to pass a 
            file-like object. 
        """
    if isinstance(fp, str):
        return fp, fp, True if close is None else close
    else:
        return getattr(fp, 'name', None), fp, False if close is None else close
