def copy_database_template(source, db_path):
 db_path_dir = os.path.dirname(db_path)
 if (not os.path.exists(db_path_dir)):
  os.makedirs(db_path_dir)
 if os.path.exists(source):
  shutil.copy(source, db_path)
  assert os.path.exists(db_path)
 elif source.lower().startswith(('http://', 'https://', 'ftp://')):
  download_to_file(source, db_path)
 else:
  raise Exception(('Failed to copy database template from source %s' % source))

def copy_database_template ( source , db_path ) : db_path_dir = os . path . dirname ( db_path ) if ( not os . path . exists ( db_path_dir ) ) : os . makedirs ( db_path_dir ) if os . path . exists ( source ) : shutil . copy ( source , db_path ) assert os . path . exists ( db_path ) elif source . lower ( ) . startswith ( ( 'http://' , 'https://' , 'ftp://' ) ) : download_to_file ( source , db_path ) else : raise Exception ( ( 'Failed to copy database template from source %s' % source ) )
copy a clean sqlite template database .