Returns the ui file for the given instance and module file.
    
    :param      moduleFile | <str>
                inst       | <QWidget>
    
    :return     <str>

def uiFile(modulefile, inst, theme='', className=None):
    """
    Returns the ui file for the given instance and module file.
    
    :param      moduleFile | <str>
                inst       | <QWidget>
    
    :return     <str>
    """
    if className is None:
        className = inst.__class__.__name__

    # use a module's name vs. filepath
    if modulefile in sys.modules:
        modulefile = sys.modules[modulefile].__file__
    
    clsname  = className.lower()
    basepath = os.path.dirname(nativestring(modulefile))
    
    if theme:
        theme_name = '{0}.{1}.ui'.format(clsname, theme)
        theme_file = os.path.join(basepath, 'ui', theme_name)
        theme_file = re.sub('[\w\.]+\?\d+', '', theme_file)
        
        if os.path.exists(theme_file):
            return theme_file
    
    base_name = '{0}.ui'.format(clsname)
    base_file = os.path.join(basepath, 'ui', base_name)
    base_file = re.sub('[\w\.]+\?\d+', '', base_file)
    
    return base_file