<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

async def create_collection(db, model_class: MongoCollectionMixin):
    '''
    Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class

    :param db:
        A database handle
    :type db:
        motor.motor_asyncio.AsyncIOMotorClient
    :param model_class:
        The  model to create
    :type model_class:
        Subclass of ``Model`` mixed with ``MongoCollectionMixin``
    '''
    name = model_class.get_collection_name()
    if name:
        try:
            # create collection
            coll = await db.create_collection(name, **model_class._meta.creation_args)
        except CollectionInvalid:  # collection already exists
            coll = db[name]

        # create indices
        if hasattr(model_class._meta, 'indices') and isinstance(model_class._meta.indices, list):
            for index in model_class._meta.indices:
                try:
                    index_kwargs = {
                        'name': index.get('name', '_'.join([x[0] for x in index['fields']])),
                        'unique': index.get('unique', False),
                        'sparse': index.get('sparse', False),
                        'expireAfterSeconds': index.get('expireAfterSeconds', None),
                        'background': True

                    }
                    if 'partialFilterExpression' in index:
                        index_kwargs['partialFilterExpression'] = index.get('partialFilterExpression', {})
                    await db[name].create_index(
                        index['fields'],
                        **index_kwargs
                    )
                except OperationFailure as ex:
                    pass  # index already exists ? TODO: do something with this
        return coll
    return None