Syntax Highlight

import pandas

def analyzerFlags(field):
    def wrap(item):
        if type(item) is dict:
            analyzer = item.get(field, {})

            if analyzer is not None:
                flags = {'moderate': analyzer.get('moderate', False)}
                return pandas.Series(flags).astype(int).to_dict()

        return {}

    return wrap

def scamDetector(item):
    if type(item) is dict:
        return pandas.Series(item.get('scam_detector', {}).get('flags', {})).astype(int).to_dict()

    return {}

def captchaChecker(item):
    if type(item) is dict:
        return {'score': item.get('captcha_checker', {}).get('score_percentage', 0)}

    return {}

def blacklistChecker(item):
    if type(item) is dict:
        arr = item.get('blacklist_checker', {}).get('words', [])
        return {"%s" % value: 1 for (index, value) in enumerate(arr)}

    return {}

def userSpamDatabase(item):
    if type(item) is dict:
        return pandas.Series(item.get('user_spam_database', {}).get('matches', {})).astype(int).to_dict()

    return {}

Вот вам питон