<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stat_object(self, bucket_name, object_name, sse=None):
 """ Check if an object exists. :param bucket_name: Bucket of object. :param object_name: Name of object :return: Object metadata if object exists """


        headers = {}
        if sse:
            is_valid_sse_c_object(sse=sse)
            headers.update(sse.marshal())

        is_valid_bucket_name(bucket_name)
        is_non_empty_string(object_name)

        response = self._url_open('HEAD', bucket_name=bucket_name,
                                  object_name=object_name, headers=headers)

        etag = response.headers.get('etag', '').replace('"', '')
        size = int(response.headers.get('content-length', '0'))
        content_type = response.headers.get('content-type', '')
        last_modified = response.headers.get('last-modified')

        ## Capture only custom metadata.
        custom_metadata = dict()
        for k in response.headers:
            if is_supported_header(k) or is_amz_header(k):
                custom_metadata[k] = response.headers.get(k)

        if last_modified:
            last_modified = dateutil.parser.parse(last_modified).timetuple()
        return Object(bucket_name, object_name, last_modified, etag, size,
                      content_type=content_type, metadata=custom_metadata)