'Leases a number of tasks from the Queue for a period of time.
This method can only be performed on a pull Queue. Any non-pull tasks in
the pull Queue will be converted into pull tasks when being leased. If
fewer than max_tasks are available, all available tasks will be returned.
The lease_tasks method supports leasing at most 1000 tasks for no longer
than a week in a single call.
Args:
lease_seconds: Number of seconds to lease the tasks.
max_tasks: Max number of tasks to lease from the pull Queue.
tag: The to query for, or None to group by the first available tag.
deadline: The maximum number of seconds to wait before aborting the
method call.
Returns:
A list of tasks leased from the Queue.
Raises:
InvalidLeaseTimeError: if lease_seconds is not a valid float or integer
number or is outside the valid range.
InvalidMaxTasksError: if max_tasks is not a valid integer or is outside
the valid range.
InvalidQueueModeError: if invoked on a queue that is not in pull mode.
Error-subclass on application errors.'

def lease_tasks_by_tag(self, lease_seconds, max_tasks, tag=None, deadline=10):

    _ValidateDeadline(deadline)
    rpc = create_rpc(deadline)
    self.lease_tasks_by_tag_async(lease_seconds, max_tasks, tag, rpc)
    return rpc.get_result()
