def get_tag( ec, obj, tag ):
    """
        Get the value of a tag associated with the given resource object.
        Returns None if the tag is not set. Warning: EC2 tags are case-sensitive.
    """
    tags = get_tags( ec, obj.id )
    found = 0
    for t in tags:
        if t.name == tag:
            found = 1
            break
    if found:
        return t
    else:
        return None