def BytesDecoder(field_number, is_repeated, is_packed, key, new_default):
local_DecodeVarint = _DecodeVarint<EOL>assert not is_packed<EOL>if is_repeated:<EOL><INDENT>tag_bytes = encoder.TagBytes(field_number,<EOL>wire_format.WIRETYPE_LENGTH_DELIMITED)<EOL>tag_len = len(tag_bytes)<EOL>def DecodeRepeatedField(buffer, pos, end, message, field_dict):<EOL><INDENT>value = field_dict.get(key)<EOL>if value is None:<EOL><INDENT>value = field_dict.setdefault(key, new_default(message))<EOL><DEDENT>while <NUM_LIT:1>:<EOL><INDENT>(size, pos) = local_DecodeVarint(buffer, pos)<EOL>new_pos = pos + size<EOL>if new_pos > end:<EOL><INDENT>raise _DecodeError('<STR_LIT>')<EOL><DEDENT>value.append(buffer[pos:new_pos])<EOL>pos = new_pos + tag_len<EOL>if buffer[new_pos:pos] != tag_bytes or new_pos == end:<EOL><INDENT>return new_pos<EOL><DEDENT><DEDENT><DEDENT>return DecodeRepeatedField<EOL><DEDENT>else:<EOL><INDENT>def DecodeField(buffer, pos, end, message, field_dict):<EOL><INDENT>(size, pos) = local_DecodeVarint(buffer, pos)<EOL>new_pos = pos + size<EOL>if new_pos > end:<EOL><INDENT>raise _DecodeError('<STR_LIT>')<EOL><DEDENT>field_dict[key] = buffer[pos:new_pos]<EOL>return new_pos<EOL><DEDENT>return DecodeField<EOL><DEDENT>
Returns a decoder for a bytes field.