docs: def _get_stage_id(self, stage):
          '''
          :param stage: A stage ID, name, or index (stage index is the number n for the nth stage, starting from 0; can be provided as an int or a string)
          :type stage: int or string
          :returns: The stage ID (this is a no-op if it was already a stage ID)
          :raises: :class:`~dxpy.exceptions.DXError` if *stage* could not be parsed, resolved to a stage ID, or it could not be found in the workflow
          '''
          # first, if it is a string, see if it is an integer
          if isinstance(stage, basestring):
              try:
                  stage = int(stage)
              except:
                  # we'll try parsing it as a string later
                  pass
  
          if not isinstance(stage, basestring):
              # Try to parse as stage index; ensure that if it's not a
              # string that it is an integer at this point.
              try:
                  stage_index = int(stage)
              except:
                  raise DXError('DXWorkflow: the given stage identifier was neither a string stage ID nor an integer index')
              if stage_index < 0 or stage_index >= len(self.stages):
                  raise DXError('DXWorkflow: the workflow contains ' + str(len(self.stages)) + \
                                ' stage(s), and the numerical value of the given stage identifier is out of range')
              return self.stages[stage_index].get("id")
  
          if re.compile('^([a-zA-Z_]|stage-)[0-9a-zA-Z_]*$').match(stage) is not None:
              # Check if there exists a stage with this stage id
              stage_id_exists = any([stg['id'] for stg in self.stages if stg.get('id') == stage])
              if stage_id_exists:
                  return stage
  
          # A stage with the provided ID can't be found in the workflow, so look for it as a name
          stage_ids_matching_name = [stg['id'] for stg in self.stages if stg.get('name') == stage]
          if len(stage_ids_matching_name) == 0:
              raise DXError('DXWorkflow: the given stage identifier ' + stage + ' could not be found as a stage ID nor as a stage name')
          elif len(stage_ids_matching_name) > 1:
              raise DXError('DXWorkflow: more than one workflow stage was found to have the name "' + stage + '"')
          else:
              return stage_ids_matching_name[0]