Wrapper for a byte-slice that formats it as a string if possible and as bytes otherwise.
Helper function to take a subsection from buf.
buf