def rebase(self):
    self.refetch_info()
    if (not self.rebase_in_progress):
        self._api.call(PUT('/projects/{0.project_id}/merge_requests/{0.iid}/rebase'.format(self)))
    else:
        log.info('A rebase was already in progress on the merge request!')
    max_attempts = 30
    wait_between_attempts_in_secs = 1
    for _ in range(max_attempts):
        self.refetch_info()
        if (not self.rebase_in_progress):
            if self.merge_error:
                raise MergeRequestRebaseFailed(self.merge_error)
            return
        time.sleep(wait_between_attempts_in_secs)
    raise TimeoutError('Waiting for merge request to be rebased by GitLab')
def rebase(self):
    self.refetch_info()
    if (not self.rebase_in_progress):
        self._api.call(PUT('/projects/{0.project_id}/merge_requests/{0.iid}/rebase'.format(self)))
    else:
        log.info('A rebase was already in progress on the merge request!')
    max_attempts = 30
    wait_between_attempts_in_secs = 1
    for _ in range(max_attempts):
        self.refetch_info()
        if (not self.rebase_in_progress):
            if self.merge_error:
                raise MergeRequestRebaseFailed(self.merge_error)
            return
        time.sleep(wait_between_attempts_in_secs)
    raise TimeoutError('Waiting for merge request to be rebased by GitLab')