os.path.isdir()

Returns True, if the argument points to an existing directory.

In [2]: import os
In [3]: os.path.isdir('/etc')
Out[3]: True