def compile_recipe(src):
 if (not isinstance(src, unicode)):
  match = re.search('coding[:=]\\s*([-\\w.]+)', src[:200])
  enc = (match.group(1) if match else 'utf-8')
  src = src.decode(enc)
 src = re.sub('^#.*coding\\s*[:=]\\s*([-\\w.]+)', '#', src.lstrip(u'\ufeff'), flags=re.MULTILINE)
 src = io.StringIO(src, newline=None).getvalue()
 namespace = {'BasicNewsRecipe': BasicNewsRecipe, 'AutomaticNewsRecipe': AutomaticNewsRecipe, 'time': time, 're': re, 'BeautifulSoup': BeautifulSoup}
 exec src in namespace
 for x in namespace.itervalues():
  if (isinstance(x, type) and issubclass(x, BasicNewsRecipe) and (x not in basic_recipes)):
   return x
 return None

def compile_recipe ( src ) : if ( not isinstance ( src , unicode ) ) : match = re . search ( 'coding[:=]\\s*([-\\w.]+)' , src [ : 200 ] ) enc = ( match . group ( 1 ) if match else 'utf-8' ) src = src . decode ( enc ) src = re . sub ( '^#.*coding\\s*[:=]\\s*([-\\w.]+)' , '#' , src . lstrip ( u'\ufeff' ) , flags = re . MULTILINE ) src = io . StringIO ( src , newline = None ) . getvalue ( ) namespace = { 'BasicNewsRecipe' : BasicNewsRecipe , 'AutomaticNewsRecipe' : AutomaticNewsRecipe , 'time' : time , 're' : re , 'BeautifulSoup' : BeautifulSoup } exec src in namespace for x in namespace . itervalues ( ) : if ( isinstance ( x , type ) and issubclass ( x , BasicNewsRecipe ) and ( x not in basic_recipes ) ) : return x return None
compile the code in src and return a recipe object .