code: def _raise_on_error(data: Union[str, dict]) -> None:
      
      if isinstance(data, str):
          raise_error(data)
      elif 'status' in data and data['status'] != 'success':
          raise_error(data['data']['message'])
docs: Raise the appropriate exception on error.