'Rewrite an interval in terms of inequalities and logic operators.'

def as_relational(self, x):

    x = sympify(x)
    if self.right_open:
        right = (x < self.end)
    else:
        right = (x <= self.end)
    if self.left_open:
        left = (self.start < x)
    else:
        left = (self.start <= x)
    return And(left, right)
