private static Func<object, bool> CreatePythonFilter(string filter)
{
StringBuilder builder = new StringBuilder();
builder.AppendLine("def run_filter(entry):");
builder.AppendFormat(" return {0}", filter);
builder.AppendLine();
ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromString(builder.ToString(), SourceCodeKind.File);
ScriptScope scope = engine.CreateScope();
source.Execute(scope);
return scope.GetVariable<Func<object, bool>>("run_filter");
}