code: def to_task(task):
          
          from sevenbridges.models.task import Task
          if not task:
              raise SbgError('Task is required!')
          elif isinstance(task, Task):
              return task.id
          elif isinstance(task, six.string_types):
              return task
          else:
              raise SbgError('Invalid task parameter!')
docs: Serializes task to id string
          :param task: object to serialize
          :return: string id