def coding_spec(str):
 str = str.split('\n')[:2]
 str = '\n'.join(str)
 match = coding_re.search(str)
 if (not match):
  return None
 name = match.group(1)
 import codecs
 try:
  codecs.lookup(name)
 except LookupError:
  raise LookupError, ('Unknown encoding ' + name)
 return name

def coding_spec ( str ) : str = str . split ( '\n' ) [ : 2 ] str = '\n' . join ( str ) match = coding_re . search ( str ) if ( not match ) : return None name = match . group ( 1 ) import codecs try : codecs . lookup ( name ) except LookupError : raise LookupError , ( 'Unknown encoding ' + name ) return name
return the encoding declaration according to pep 263 .