def get_object(conn, key, error='object not found', version_id=None):
    """ Gets an object from s3 """

    def helper():
        try:
            if version_id is None: return conn['client'].get_object(Bucket=conn['bucket'], Key=key)
            else: return conn['client'].get_object(Bucket=conn['bucket'], Key=key, VersionId=version_id)
        except conn['client'].exceptions.NoSuchKey:
            raise ValueError(error)
    k = helper()

    return {'key'             : key,
            'version_id'      : k['VersionId'],
            'body'            : k['Body'],
            'content_length'  : k['ContentLength'],
            'content_type'    : k['ContentType'],
            'metadata'        : k['Metadata'],
            'last_modified'   : k['LastModified']}