def create_gsi(client, table_name, index_name,
               read_units=None, write_units=None):
    """Create new GSI for DynamoDB table

    Parameters
    ----------
    client : boto3.Client
        boto3 Client
    table_name : str
        Name of DynamoDB table
    index_name : str
        Name for GSI
    read_units : int, optional
        DynamoDB ReadCapacityUnits for index if table is Provisioned, by default None
    write_units : int, optional
         DynamoDB WriteCapacityUnits for index if table is Provisioned, by default None

    Returns
    -------
    dict
        [description]
    """  # noqa E501
    gsi_config = {
        'Create': {
            'IndexName': index_name,
            'KeySchema': [
                {
                    'AttributeName': 'isRecent',
                    'KeyType': 'HASH'
                },
                {
                    'AttributeName': 'createdAt',
                    'KeyType': 'RANGE'
                }
            ],
            'Projection': {
                'ProjectionType': 'ALL'
            }
        }
    }

    # Only valid if table's read/write capacity mode is Provisioned
    if read_units and write_units:
        gsi_config['Create']['ProvisionedThroughput'] = {
            'ReadCapacityUnits': read_units,
            'WriteCapacityUnits': write_units
        }

    resp = client.update_table(
        AttributeDefinitions=[
            {
                'AttributeName': 'isRecent',
                'AttributeType': 'N'
            },
            {
                'AttributeName': 'createdAt',
                'AttributeType': 'S'
            }
        ],
        TableName=table_name,
        GlobalSecondaryIndexUpdates=[gsi_config]
    )
    return resp