public static string Print([CanBeNull] object item, [CanBeNull] PrintSettings settings) { try { settings = settings ?? PrintSettings.Default; var token = PrintTokenFactory.Create(item, settings); var context = new PrintContext(settings); if (settings.InitialIndent) { context.IncreaseDepth(); } token.Print(context); return(context.Content); } catch (Exception error) { return($"<error of type '{error.GetType().Name}': {error.Message}>"); } }