def round_margins(glyph, gridsize, left=True, right=True):
    if left:
        _left = float(glyph.leftMargin) / gridsize
        glyph.leftMargin = round(_left) * gridsize
        glyph.update()
    if right:
        _right = float(glyph.rightMargin) / gridsize
        glyph.rightMargin = round(_right) * gridsize
        glyph.update()

#-------------
# glyph names
#-------------
Round left and/or right margins to multiples of ``gridsize``.
dataset/ETHPy150Open gferreira/hTools2/Lib/hTools2/modules/glyphutils.py/round_margins