<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_sample_file(self, sample_path, source, reference, method='', file_format='raw', file_password='', sample_name='', campaign='', confidence='', description='', bucket_list=[]):
 """ Adds a file sample. For meta data only use add_sample_meta. Args: sample_path: The path on disk of the sample to upload source: Source of the information reference: A reference where more information can be found method: The method for obtaining the sample. file_format: Must be raw, zip, or rar. file_password: The password of a zip or rar archived sample sample_name: Specify a filename for the sample rather than using the name on disk campaign: An associated campaign confidence: The campaign confidence description: A text description of the sample bucket_list: A list of bucket list items to add Returns: A JSON sample object or None if there was an error. """

        if os.path.isfile(sample_path):
            data = {
                'api_key': self.api_key,
                'username': self.username,
                'source': source,
                'reference': reference,
                'method': method,
                'filetype': file_format,
                'upload_type': 'file',
                'campaign': campaign,
                'confidence': confidence,
                'description': description,
                'bucket_list': ','.join(bucket_list),
            }
            if sample_name != '':
                data['filename'] = sample_name
            with open(sample_path, 'rb') as fdata:
                if file_password:
                    data['password'] = file_password
                r = requests.post('{0}/samples/'.format(self.url),
                                  data=data,
                                  files={'filedata': fdata},
                                  verify=self.verify,
                                  proxies=self.proxies)
                if r.status_code == 200:
                    result_data = json.loads(r.text)
                    return result_data
                else:
                    log.error('Error with status code {0} and message '
                              '{1}'.format(r.status_code, r.text))
            return None