def check_ddir(d):
 expanded = os.path.expanduser(d)
 if os.path.isdir(expanded):
  message = ((('Downloads will be saved to ' + c.y) + d) + c.w)
  return dict(valid=True, message=message, value=expanded)
 else:
  message = ((('Not a valid directory: ' + c.r) + d) + c.w)
  return dict(valid=False, message=message)

def check_ddir ( d ) : expanded = os . path . expanduser ( d ) if os . path . isdir ( expanded ) : message = ( ( ( 'Downloads will be saved to ' + c . y ) + d ) + c . w ) return dict ( valid = True , message = message , value = expanded ) else : message = ( ( ( 'Not a valid directory: ' + c . r ) + d ) + c . w ) return dict ( valid = False , message = message )
check whether dir is a valid directory .