def is_optional(attr):
    """
    Helper method to find if an attribute is mandatory

    :param attr:
    :return:
    """
    return isinstance(attr.validator, _OptionalValidator) or (attr.default is not None and attr.default is not NOTHING)
Helper method to find if an attribute is mandatory

    :param attr:
    :return: