def METHOD_NAME(json_line, args):
    # Read the line.
    document = json.loads(json_line)
    text = document['text']
    output = {'remove_512': False, 'remove_256_javascript': False, \
        'remove_512_non_english': False, 'ftfy_fix_text': False, \
        'general_cleaning': False}
    try:
        # Reomove all docs with less than 512 characters
        if "remove_512" in args.tasks:
            if len(text) < 512:
                output['remove_512'] = True
                return output, text, document, True
        # Remove docs if less than 256 character length and contains Javascript
        if "remove_256_javascript" in args.tasks:
            if len(text) < 256 and 'javascript' in text.lower():
                output['remove_256_javascript'] = True
                return output, text, document, True
        # Remove docs < 512 and nonenglish
        if "remove_512_non_english" in args.tasks:
            if len(text) < 512 and detect(text) != 'en':
                output['remove_512_non_english'] = True
                return output, text, document, True
        # Fix the text using ftfy, don't remove the text, hence return False
        if "ftfy_fix_text" in args.tasks:
            fixed_text = ftfy.fix_text(text)
            output['ftfy_fix_text'] = True
            return output, fixed_text, document, False
        # Cleaning extra spaces and newlines
        if "general_cleaning" in args.tasks:
            cleaned_text = re.sub(r"  +|\b\n+ |\b\n+", " ", text)
            #cleaned_text = re.sub(r"\n\n+", "\n\n", text) # used this for Gutenberg dataset
            #cleaned_text = re.sub(r"\n", "\n\n", text) # Used this for realnews
            # stories datasets
            #cleaned_text = re.sub(r" \'", "'", text)
            #cleaned_text = re.sub(r" \!", "!", cleaned_text)
            #cleaned_text = re.sub(r" \.", ".", cleaned_text)
            #cleaned_text = re.sub(r" \?", "?", cleaned_text)
            #cleaned_text = re.sub(r" - ", "-", cleaned_text)
            ##cleaned_text = re.sub(r"\" ", "\"", cleaned_text)
            #cleaned_text = re.sub(r" @ ", "@", cleaned_text)
            output['general_cleaning'] = True
            return output, cleaned_text, document, False
    except Exception as e:
        print('Error: *************************\n{}\ntext: {}'.format(e, \
            text), flush=True)
        return output, text, document, True
    # don't remove
    return output, text, document, False