<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collect_s3(self):
 """ Collect and download build-artifacts from S3 based on git reference """

        print('Collecting artifacts matching tag/sha %s from S3 bucket %s' % (self.gitref, s3_bucket))
        self.s3 = boto3.resource('s3')
        self.s3_bucket = self.s3.Bucket(s3_bucket)
        self.s3.meta.client.head_bucket(Bucket=s3_bucket)
        for key in self.s3_bucket.objects.all():
            self.collect_single_s3(key.key)

        for a in self.artifacts:
            a.download(self.dlpath)