code: def get_workflow_states_for(brain_or_object):
      
      portal_type = api.get_portal_type(brain_or_object)
      states = states_by_type.get(portal_type, None)
      if states:
          return states
  
      # Retrieve the states from the workflows this object is bound to
      states = []
      wf_tool = api.get_tool("portal_workflow")
      for wf_id in get_workflow_ids_for(brain_or_object):
          workflow = wf_tool.getWorkflowById(wf_id)
          wf_states = map(lambda state: state[0], workflow.states.items())
          states.extend(wf_states)
  
      states = list(set(states))
      states_by_type[portal_type] = states
      return states
docs: Returns a list with the states supported by the workflows the object
      passed in is bound to