code: def _validate_and_parse_block_key(self, block_key, course_key_obj):
          
          try:
              block_key_obj = UsageKey.from_string(block_key)
          except InvalidKeyError:
              raise ValidationError(_("Invalid block key: {}").format(block_key))
  
          if block_key_obj.run is None:
              expected_matching_course_key = course_key_obj.replace(run=None)
          else:
              expected_matching_course_key = course_key_obj
  
          if block_key_obj.course_key != expected_matching_course_key:
              raise ValidationError(
                  _("Block with key: '{key}' is not in course {course}").format(key=block_key, course=course_key_obj)
              )
  
          return block_key_obj
docs: Returns a validated, parsed UsageKey deserialized from the given block_key.