code: def IsValidBase64String(string_to_validate):
      
      # '-' is not supported char for decoding in Python(same as C# and Java) which has similar logic while parsing ResourceID generated by backend
      try:
          buffer = base64.standard_b64decode(string_to_validate.replace('-', '/'))
          if len(buffer) != 4:
              return False
      except Exception as e:
          if six.PY2:
              e = e.message
          if type(e) == binascii.Error:
              return False
          else:
              raise e
      return True
docs: Verifies if a string is a valid Base64 encoded string, after replacing '-' with '/'
  
      :param string string_to_validate:
          String to validate.
  
      :return:
          Whether given string is a valid base64 string or not.
      :rtype: str