def METHOD_NAME(text, directory, filename, dev):
    if dev:
        directory_path = os.path.join(PATH, METADATA_DEV_PATH, directory)
    else:
        directory_path = os.path.join(PATH, METADATA_PATH, directory)
    if not os.path.exists(directory_path):
        os.makedirs(directory_path)
    if filename == 'short_description.txt':
        limit = 80
    else:
        limit = 0
    text = clean_text(text, limit)
    check_title(directory_path)
    file_path = os.path.join(directory_path, filename)
    print("Writing %s..." % file_path)
    with codecs.open(file_path, 'w', 'utf-8') as f:
        f.write(text)