<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def default_bucket_link_factory(pid):
 """Factory for record bucket generation."""

    try:
        record = Record.get_record(pid.get_assigned_object())
        bucket = record.files.bucket

        return url_for('invenio_files_rest.bucket_api',
                       bucket_id=bucket.id, _external=True)
    except AttributeError:
        return None