def get_region_code(x, y):
    """Return region code for a point(x,y).

    Works by performing bitwise OR operations (the ones
    using the '|=' operator) on the code of the inside
    region based on the relationship between the
    coordinates' values and the values of the clipping
    area boundaries.
    """
    code = INSIDE

    if x < x_min:
        code |= LEFT  # to left of clipping area
    elif x > x_max:
        code |= RIGHT  # to right of clipping area

    if y < y_min:
        code |= BOTTOM  # below clipping area
    elif y > y_max:
        code |= TOP  # above clipping area

    return code
Return region code for a point(x,y).

    Works by performing bitwise OR operations (the ones
    using the '|=' operator) on the code of the inside
    region based on the relationship between the
    coordinates' values and the values of the clipping
    area boundaries.
    
nodezator/graphman/socketparenthood/utils.py