def round(self, contract=False):
def _round(seg):<EOL><INDENT>if contract:  <EOL><INDENT>a = type(seg[<NUM_LIT:0>])(ceil(seg[<NUM_LIT:0>]))<EOL>b = type(seg[<NUM_LIT:1>])(floor(seg[<NUM_LIT:1>]))<EOL><DEDENT>else:  <EOL><INDENT>a = type(seg[<NUM_LIT:0>])(floor(seg[<NUM_LIT:0>]))<EOL>b = type(seg[<NUM_LIT:1>])(ceil(seg[<NUM_LIT:1>]))<EOL><DEDENT>if a >= b:  <EOL><INDENT>return type(seg)(<NUM_LIT:0>, <NUM_LIT:0>)  <EOL><DEDENT>return type(seg)(a, b)<EOL><DEDENT>new = self.copy()<EOL>new.active = type(new.active)(map(_round, new.active))<EOL>new.known = type(new.known)(map(_round, new.known))<EOL>return new.coalesce()<EOL>
Round this flag to integer segments.

        Parameters
        ----------
        contract : `bool`, optional
            if `False` (default) expand each segment to the containing
            integer boundaries, otherwise contract each segment to the
            contained boundaries

        Returns
        -------
        roundedflag : `DataQualityFlag`
            A copy of the original flag with the `active` and `known` segments
            padded out to integer boundaries.