Broke out extraction of sourcedid and id into separate lines because it's possible for sourcedid to exist and be None, causing .get('id') to generate an error.