def to_ufo_guidelines(self, ufo_obj, glyphs_obj):
guidelines = glyphs_obj.guides<EOL>if not guidelines:<EOL><INDENT>return<EOL><DEDENT>new_guidelines = []<EOL>for guideline in guidelines:<EOL><INDENT>new_guideline = {}<EOL>x, y = guideline.position<EOL>angle = guideline.angle % <NUM_LIT><EOL>if _is_vertical(x, y, angle):<EOL><INDENT>new_guideline["<STR_LIT:x>"] = x<EOL><DEDENT>elif _is_horizontal(x, y, angle):<EOL><INDENT>new_guideline["<STR_LIT:y>"] = y<EOL><DEDENT>else:<EOL><INDENT>new_guideline["<STR_LIT:x>"] = x<EOL>new_guideline["<STR_LIT:y>"] = y<EOL>new_guideline["<STR_LIT>"] = angle<EOL><DEDENT>name = guideline.name<EOL>if name is not None:<EOL><INDENT>m = IDENTIFIER_NAME_RE.match(name)<EOL>if m:<EOL><INDENT>new_guideline["<STR_LIT>"] = m.group(<NUM_LIT:2>)<EOL>name = name[: -len(m.group(<NUM_LIT:1>))]<EOL><DEDENT>m = COLOR_NAME_RE.match(name)<EOL>if m:<EOL><INDENT>new_guideline["<STR_LIT>"] = m.group(<NUM_LIT:2>)<EOL>name = name[: -len(m.group(<NUM_LIT:1>))]<EOL><DEDENT><DEDENT>if guideline.locked:<EOL><INDENT>name = (name or "<STR_LIT>") + LOCKED_NAME_SUFFIX<EOL><DEDENT>if name:<EOL><INDENT>new_guideline["<STR_LIT:name>"] = name<EOL><DEDENT>new_guidelines.append(new_guideline)<EOL><DEDENT>ufo_obj.guidelines = new_guidelines<EOL>
Set guidelines.