def parse_amc(source):
lines = <NUM_LIT:0><EOL>frames = <NUM_LIT:1><EOL>frame = {}<EOL>degrees = False<EOL>for line in source:<EOL><INDENT>lines += <NUM_LIT:1><EOL>line = line.split('<STR_LIT:#>')[<NUM_LIT:0>].strip()<EOL>if not line:<EOL><INDENT>continue<EOL><DEDENT>if line.startswith('<STR_LIT::>'):<EOL><INDENT>if line.lower().startswith('<STR_LIT>'):<EOL><INDENT>degrees = True<EOL><DEDENT>continue<EOL><DEDENT>if line.isdigit():<EOL><INDENT>if int(line) != frames:<EOL><INDENT>raise RuntimeError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(lines, frames, line))<EOL><DEDENT>yield frame<EOL>frames += <NUM_LIT:1><EOL>frame = {}<EOL>continue<EOL><DEDENT>fields = line.split()<EOL>frame[fields[<NUM_LIT:0>]] = list(map(float, fields[<NUM_LIT:1>:]))<EOL><DEDENT>
Parse an AMC motion capture data file.

    Parameters
    ----------
    source : file
        A file-like object that contains AMC motion capture text.

    Yields
    ------
    frame : dict
        Yields a series of motion capture frames. Each frame is a dictionary
        that maps a bone name to a list of the DOF configurations for that bone.