docs: def decode_copy_value(value):
      """
      Decodes value received as part of Postgres `COPY` command.
  
      :param value: Value to decode.
      :type value: str
  
      :return: Either None if the value is NULL string, or the given value where
               escape sequences have been decoded from.
      :rtype: str|None
      """
      # Test for null values first.
      if value == POSTGRES_COPY_NULL_VALUE:
          return None
  
      # If there is no backslash present, there's nothing to decode.
      #
      # This early return provides a little speed-up, because it's very
      # common to not have anything to decode and then simple search for
      # backslash is faster than the regex sub below.
      if '\\' not in value:
          return value
  
      return DECODE_REGEX.sub(unescape_single_character, value)