Returns the cardinality of the given resource attribute.

    :returns: One of the constants defined in
      :class:`evererst.constants.CARDINALITY_CONSTANTS`.
    :raises ValueError: If the given attribute is not a relation attribute
      (i.e., if it is a terminal attribute).

def get_attribute_cardinality(attribute):
    """
    Returns the cardinality of the given resource attribute.

    :returns: One of the constants defined in
      :class:`evererst.constants.CARDINALITY_CONSTANTS`.
    :raises ValueError: If the given attribute is not a relation attribute
      (i.e., if it is a terminal attribute).
    """
    if attribute.kind == RESOURCE_ATTRIBUTE_KINDS.MEMBER:
        card = CARDINALITY_CONSTANTS.ONE
    elif attribute.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION:
        card = CARDINALITY_CONSTANTS.MANY
    else:
        raise ValueError('Can not determine cardinality for non-terminal '
                         'attributes.')
    return card