def file_basename(name, return_ext=False):
    '\n    Strips up to 2 extensions of length up to 4 characters and starting with alpha\n    not a digit, so we could get rid of .tar.gz etc\n    '
    bname = basename(name)
    fbname = re.sub('(\\.[a-zA-Z_]\\S{1,4}){0,2}$', '', bname)
    if return_ext:
        return (fbname, bname[(len(fbname) + 1):])
    else:
        return fbname
Strips up to 2 extensions of length up to 4 characters and starting with alpha
not a digit, so we could get rid of .tar.gz etc
def file_basename(name, return_ext=False):
    '\n    Strips up to 2 extensions of length up to 4 characters and starting with alpha\n    not a digit, so we could get rid of .tar.gz etc\n    '
    bname = basename(name)
    fbname = re.sub('(\\.[a-zA-Z_]\\S{1,4}){0,2}$', , bname)
    if return_ext:
        return (fbname, bname[(len(fbname) + 1):])
    else:
        return fbname