Python3: If ... else .... ignored when checking Json attribute existance : I have the following python3 code to check if a attribute is in a Json (or has a value different than null)

    def has_attribute(data, attribute):
        return (attribute in data) and (data[attribute] is not None)

This is the function which checks that the attribute is in the json and has a value different than null.

    if has_attribute(json_request,"offer_id"):
            print("IT IS")
    else:
            print("NO")

The thing is that when I pass a Json it doesn't print nothing! 
Why?