def copy_smart_previews(local_catalog, cloud_catalog, local2cloud=True):
lcat_noext = local_catalog[<NUM_LIT:0>:local_catalog.rfind("<STR_LIT>")]<EOL>ccat_noext = cloud_catalog[<NUM_LIT:0>:cloud_catalog.rfind("<STR_LIT>")]<EOL>lsmart = join(dirname(local_catalog),"<STR_LIT>"%basename(lcat_noext))<EOL>csmart = join(dirname(cloud_catalog),"<STR_LIT>"%basename(ccat_noext))<EOL>if local2cloud and os.path.isdir(lsmart):<EOL><INDENT>logging.info("<STR_LIT>"%(lsmart, csmart))<EOL>distutils.dir_util.copy_tree(lsmart,csmart, update=<NUM_LIT:1>)<EOL><DEDENT>elif os.path.isdir(csmart):<EOL><INDENT>logging.info("<STR_LIT>"%(csmart, lsmart))<EOL>distutils.dir_util.copy_tree(csmart,lsmart, update=<NUM_LIT:1>)<EOL><DEDENT>
Copy Smart Previews from local to cloud or
       vica versa when 'local2cloud==False'
       NB: nothing happens if source dir doesn't exist