<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def forward(node, analysis):
 """Perform a given analysis on all functions within an AST."""

  if not isinstance(analysis, Forward):
    raise TypeError('not a valid forward analysis object')
  for succ in gast.walk(node):
    if isinstance(succ, gast.FunctionDef):
      cfg_obj = CFG.build_cfg(succ)
      analysis.visit(cfg_obj.entry)
  return node