def inspect_to_container_metadata(c_metadata_object, inspect_data, image_instance):
inspect_to_metadata(c_metadata_object, inspect_data)<EOL>status = ContainerStatus.get_from_docker(<EOL>graceful_get(inspect_data, "<STR_LIT>", "<STR_LIT>"),<EOL>graceful_get(inspect_data, "<STR_LIT>", "<STR_LIT>"),<EOL>)<EOL>image_id = graceful_get(inspect_data, "<STR_LIT>")<EOL>if image_id:<EOL><INDENT>if "<STR_LIT::>" in image_id:<EOL><INDENT>image_instance.identifier = image_id.split('<STR_LIT::>')[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>image_instance.identifier = image_id<EOL><DEDENT><DEDENT>port_mappings = dict()<EOL>raw_port_mappings = graceful_get(inspect_data, '<STR_LIT>', '<STR_LIT>') or {}<EOL>for key, value in raw_port_mappings.items():<EOL><INDENT>for item in value:<EOL><INDENT>logger.debug("<STR_LIT>", key, item)<EOL>li = port_mappings.get(key, [])<EOL>raw_host_port = item['<STR_LIT>']<EOL>if raw_host_port == "<STR_LIT>":<EOL><INDENT>int_port = None<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>int_port = int(raw_host_port)<EOL><DEDENT>except ValueError as ex:<EOL><INDENT>logger.error("<STR_LIT>", ex)<EOL>continue<EOL><DEDENT><DEDENT>li.append(int_port)<EOL>port_mappings.update({key: li})<EOL><DEDENT><DEDENT>c_metadata_object.status = status<EOL>c_metadata_object.port_mappings = port_mappings<EOL>c_metadata_object.hostname = graceful_get(inspect_data, '<STR_LIT>', '<STR_LIT>')<EOL>raw_networks = graceful_get(inspect_data, "<STR_LIT>", "<STR_LIT>").values()<EOL>if raw_networks:<EOL><INDENT>c_metadata_object.ipv4_addresses = [<EOL>graceful_get(x, "<STR_LIT>")<EOL>for x in raw_networks if graceful_get(x, "<STR_LIT>")]<EOL>c_metadata_object.ipv6_addresses = [<EOL>graceful_get(x, "<STR_LIT>")<EOL>for x in raw_networks if graceful_get(x, "<STR_LIT>")]<EOL><DEDENT>c_metadata_object.image = image_instance<EOL>name = graceful_get(inspect_data, "<STR_LIT:Name>")<EOL>if name:<EOL><INDENT>name = name[<NUM_LIT:1>:] if name.startswith("<STR_LIT:/>") else name  <EOL>c_metadata_object.name = name<EOL><DEDENT>return c_metadata_object<EOL>
process data from `docker container inspect` and update provided container metadata object

:param c_metadata_object: instance of ContainerMetadata
:param inspect_data: dict, metadata from `docker inspect` or `dockert_client.images()`
:param image_instance: instance of DockerImage
:return: instance of ContainerMetadata