defcrc(msg,div,code='11111111'):"""Cyclic Redundancy Check
Generates an error detecting code based on an inputted message
and divisor in the form of a polynomial representation.
Arguments:
msg: The input message of which to generate the output code.
div: The divisor in polynomial form. For example, if the polynomial
of x^3 + x + 1 is given, this should be represented as '1011' in
the div argument.
code: This is an option argument where a previously generated code may
be passed in. This can be used to check validity. If the inputted
code produces an outputted code of all zeros, then the message has
no errors.
Returns:
An error-detecting code generated by the message and the given divisor.
"""# Append the code to the message. If no code is given, default to '1111111'# Un