'Abondon all hope ye who enter here.
You\'re now probably wondering if I was drunk and/or high when writing this.
Getting this to work took a toll on my sanity. So yes. a lot.'

def _spider(self, subfolder, depth):

    if (subfolder in ['', '.']):
        subfolder = '*'
    elif subfolder.startswith('*/'):
        subfolder = (subfolder[2:] + '/*')
    else:
        subfolder = (subfolder.replace('/*/', '/') + '/*')
    filelist = None
    try:
        filelist = self.smbconnection.listPath(self.share, subfolder)
        self.dir_list(filelist, subfolder)
        if (depth == 0):
            return
    except SessionError as e:
        if (not filelist):
            if ('STATUS_ACCESS_DENIED' not in str(e)):
                logging.debug('Failed    listing    files    on    share    {}    in    directory    {}:    {}'.format(self.share, subfolder, e))
            return
    for result in filelist:
        if (result.is_directory() and (result.get_longname() not in ['.', '..'])):
            if (subfolder == '*'):
                self._spider((subfolder.replace('*', '') + result.get_longname()), ((depth - 1) if depth else None))
            elif ((subfolder != '*') and (subfolder[:(-2)].split('/')[(-1)] not in self.exclude_dirs)):
                self._spider((subfolder.replace('*', '') + result.get_longname()), ((depth - 1) if depth else None))
    return
