def get_constraint(obj, name):
    """
    Get a constraint vith the given name for the given object.
    If constraint is not specified for the object returns None.
    """
    for c in obj.constraints:
        if c.type.name == name:
            return c