code: def get_instance():
      
      resources = []
      env_resource = resource.get_from_env()
      if env_resource is not None:
          resources.append(env_resource)
  
      if k8s_utils.is_k8s_environment():
          resources.append(resource.Resource(
              _K8S_CONTAINER, k8s_utils.get_k8s_metadata()))
  
      if is_gce_environment():
          resources.append(resource.Resource(
              _GCE_INSTANCE,
              gcp_metadata_config.GcpMetadataConfig().get_gce_metadata()))
      elif is_aws_environment():
          resources.append(resource.Resource(
              _AWS_EC2_INSTANCE,
              (aws_identity_doc_utils.AwsIdentityDocumentUtils()
               .get_aws_metadata())))
  
      if not resources:
          return None
      return resource.merge_resources(resources)
docs: Get a resource based on the application environment.
  
      Returns a `Resource` configured for the current environment, or None if the
      environment is unknown or unsupported.
  
      :rtype: :class:`opencensus.common.resource.Resource` or None
      :return: A `Resource` configured for the current environment.