def extract_options(field_list):
 option_list = []
 for field in field_list:
  if (len(field[0].astext().split()) != 1):
   raise BadOptionError('extension option field name may not contain multiple words')
  name = str(field[0].astext().lower())
  body = field[1]
  if (len(body) == 0):
   data = None
  elif ((len(body) > 1) or (not isinstance(body[0], nodes.paragraph)) or (len(body[0]) != 1) or (not isinstance(body[0][0], nodes.Text))):
   raise BadOptionDataError(('extension option field body may contain\na single paragraph only (option "%s")' % name))
  else:
   data = body[0][0].astext()
  option_list.append((name, data))
 return option_list

def extract_options ( field_list ) : option_list = [ ] for field in field_list : if ( len ( field [ 0 ] . astext ( ) . split ( ) ) != 1 ) : raise BadOptionError ( 'extension option field name may not contain multiple words' ) name = str ( field [ 0 ] . astext ( ) . lower ( ) ) body = field [ 1 ] if ( len ( body ) == 0 ) : data = None elif ( ( len ( body ) > 1 ) or ( not isinstance ( body [ 0 ] , nodes . paragraph ) ) or ( len ( body [ 0 ] ) != 1 ) or ( not isinstance ( body [ 0 ] [ 0 ] , nodes . Text ) ) ) : raise BadOptionDataError ( ( 'extension option field body may contain\na single paragraph only (option "%s")' % name ) ) else : data = body [ 0 ] [ 0 ] . astext ( ) option_list . append ( ( name , data ) ) return option_list
return a list of option pairs from field names & bodies .