def head(key):
    """
    Make a HEAD request for an object in S3.  This is needed to find the
    object's length so it can be accounted.  This function makes one
    billable request and anticipates another.
    """
    librato.count('blueprint-io-server.requests.head')
    statsd.increment('blueprint-io-server.requests.head')
    c = boto.connect_s3(access_key, secret_key)
    b = c.get_bucket(bucket, validate=False)
    try:
        k = b.get_key(key)
        if k is None:
            return None
        return k.size
    except (boto.exception.BotoClientError,
            boto.exception.BotoServerError,
            httplib.HTTPException,
            socket.error,
            socket.gaierror):
        return False
dataset/ETHPy150Open devstructure/blueprint/blueprint/io/server/backend.py/head/original