def load_content(file_path):
 (file_name, file_ext) = os.path.splitext(file_path)
 if (file_ext not in ALLOWED_EXTS):
  raise Exception(('Unsupported meta type %s, file %s. Allowed: %s' % (file_ext, file_path, ALLOWED_EXTS)))
 parser_func = PARSER_FUNCS.get(file_ext, None)
 with open(file_path, 'r') as fd:
  return (parser_func(fd) if parser_func else fd.read())

def load_content ( file_path ) : ( file_name , file_ext ) = os . path . splitext ( file_path ) if ( file_ext not in ALLOWED_EXTS ) : raise Exception ( ( 'Unsupported meta type %s, file %s. Allowed: %s' % ( file_ext , file_path , ALLOWED_EXTS ) ) ) parser_func = PARSER_FUNCS . get ( file_ext , None ) with open ( file_path , 'r' ) as fd : return ( parser_func ( fd ) if parser_func else fd . read ( ) )
loads content from file_path if file_paths extension is one of allowed ones .