def METHOD_NAME(annotations: tp.Dict[str, tp.Dict[str, Definition]], 
                    expression_types: tp.Dict[str, tp.List[ExpressionType]],
                    names_dict: tp.Dict[str, tp.List[utbot_mypy_runner.names.Name]],
                    indent: tp.Optional[int]):
    node_storage_key = 'nodeStorage'
    types_key = 'exprTypes'
    definitions_key = 'definitions'
    names_key = 'names'
    result: tp.Dict[str, tp.Any] = {node_storage_key: {}, types_key: {}}
    for key in annotation_node_dict:
        try:
            encoded = annotation_node_dict[key].encode()
        except:
            # Partial AnnotationNode (probably because of NoTypeVarBindingException)
            continue
        result[node_storage_key][str(key)] = encoded
    result[definitions_key] = {}
    for module in annotations.keys():
        result[definitions_key][module] = {}
        for name in annotations[module].keys():
            result[definitions_key][module][name] = annotations[module][name].encode()
    for module in expression_types.keys():
        result[types_key][module] = [x.encode() for x in expression_types[module]]
    result[names_key] = {}
    for module in names_dict.keys():
        result[names_key][module] = [x.encode() for x in names_dict[module]]
    return json.dumps(result, indent=indent)