'Check an Azure object\'s provisioning state. If something did not complete the provisioning
process, then we cannot operate on it.
:param azure_object An object such as a subnet, storageaccount, etc. Must have provisioning_state
and name attributes.
:return None'

def check_provisioning_state(self, azure_object, requested_state='present'):

    if (hasattr(azure_object, 'properties') and hasattr(azure_object.properties, 'provisioning_state') and hasattr(azure_object, 'name')):
        if isinstance(azure_object.properties.provisioning_state, Enum):
            if ((azure_object.properties.provisioning_state.value != AZURE_SUCCESS_STATE) and (requested_state != 'absent')):
                self.fail('Error    {0}    has    a    provisioning    state    of    {1}.    Expecting    state    to    be    {2}.'.format(azure_object.name, azure_object.properties.provisioning_state, AZURE_SUCCESS_STATE))
            return
        if ((azure_object.properties.provisioning_state != AZURE_SUCCESS_STATE) and (requested_state != 'absent')):
            self.fail('Error    {0}    has    a    provisioning    state    of    {1}.    Expecting    state    to    be    {2}.'.format(azure_object.name, azure_object.properties.provisioning_state, AZURE_SUCCESS_STATE))
        return
    if (hasattr(azure_object, 'provisioning_state') or (not hasattr(azure_object, 'name'))):
        if isinstance(azure_object.provisioning_state, Enum):
            if ((azure_object.provisioning_state.value != AZURE_SUCCESS_STATE) and (requested_state != 'absent')):
                self.fail('Error    {0}    has    a    provisioning    state    of    {1}.    Expecting    state    to    be    {2}.'.format(azure_object.name, azure_object.provisioning_state, AZURE_SUCCESS_STATE))
            return
        if ((azure_object.provisioning_state != AZURE_SUCCESS_STATE) and (requested_state != 'absent')):
            self.fail('Error    {0}    has    a    provisioning    state    of    {1}.    Expecting    state    to    be    {2}.'.format(azure_object.name, azure_object.provisioning_state, AZURE_SUCCESS_STATE))
