def snapshot(self, **kwargs):
    if (not self._is_enabled):
        return
    if (not self._current_build):
        raise errors.UninitializedBuildError('Cannot call snapshot before build is initialized')
    root_resource = self.loader.snapshot_resources[0]
    build_id = self._current_build['data']['id']
    snapshot_data = self.client.create_snapshot(build_id, [root_resource], **kwargs)
    missing_resources = snapshot_data['data']['relationships']['missing-resources']
    missing_resources = missing_resources.get('data', [])
    if missing_resources:
        self.client.upload_resource(build_id, root_resource.content)
    self.client.finalize_snapshot(snapshot_data['data']['id'])
def snapshot(self, **kwargs):
    if (not self._is_enabled):
        return
    if (not self._current_build):
        raise errors.UninitializedBuildError('Cannot call snapshot before build is initialized')
    root_resource = self.loader.snapshot_resources[0]
    build_id = self._current_build['data']['id']
    snapshot_data = self.client.create_snapshot(build_id, [root_resource], **kwargs)
    missing_resources = snapshot_data['data']['relationships']['missing-resources']
    missing_resources = missing_resources.get('data', [])
    if missing_resources:
        self.client.upload_resource(build_id, root_resource.content)
    self.client.finalize_snapshot(snapshot_data['data']['id'])