code: def check_partition_status(method, uri, partition, valid_statuses=None,
                             invalid_statuses=None):
      
      status = partition.properties.get('status', None)
      if status is None:
          # Do nothing if no status is set on the faked partition
          return
      if valid_statuses and status not in valid_statuses or \
              invalid_statuses and status in invalid_statuses:
          if uri.startswith(partition.uri):
              # The uri targets the partition (either is the partition uri or
              # some multiplicity under the partition uri)
              raise ConflictError(method, uri, reason=1,
                                  message="The operation cannot be performed "
                                  "because the targeted partition {} has a "
                                  "status that is not valid for the operation: "
                                  "{}".
                                  format(partition.name, status))
          else:
              # The uri targets a resource hosted by the partition
              raise ConflictError(method, uri,
                                  reason=1,  # Note: 6 not used for partitions
                                  message="The operation cannot be performed "
                                  "because partition {} hosting the targeted "
                                  "resource has a status that is not valid for "
                                  "the operation: {}".
                                  format(partition.name, status))
docs: Check that the partition is in one of the valid statuses (if specified)
      and not in one of the invalid statuses (if specified), as indicated by its
      'status' property.
  
      If the Partition object does not have a 'status' property set, this
      function does nothing (in order to make the mock support easy to use).
  
      Raises:
        ConflictError with reason 1 (reason 6 is not used for partitions).