You could do this:

    switch t := v.(type) {
    case []byte:
        return t
    case string:
        return []byte(t)