create a list out of basedir elements for which function os.path.isdir returns true, apply the os.path.abspath function on every element, and put the results in a list, basedir is set of previous list elements.
basedirs = set ( map ( os . path . abspath , filter ( os . path . isdir , basedirs ) ) )