def parseFilename(filename):
    """
        Parse out filename from any specified extensions.
        Returns rootname and string version of extension name.

        Modified from 'pydrizzle.fileutil' to allow this
        module to be independent of PyDrizzle/MultiDrizzle.

    """
    _indx = filename.find('[')
    if _indx > 0:
        _fname = filename[:_indx]
        extn = filename[_indx + 1:-1]
        if repr(extn).find(',') > 1:
            _extns = extn.split(',')
            _extn = [_extns[0], int(_extns[1])]
        elif repr(extn).find('/') > 1:
            _indx = str(extn[:extn.find('/')])
            _extn = [int(_indx)]
        elif isinstance(extn, str):
            if extn.isdigit():
                _nextn = int(extn)
            else:
                _nextn = extn
            _extn = [_nextn]
        else:
            _extn = [int(extn)]
    else:
        _fname = filename
        _extn = None
    return _fname, _extn
