def create_party(roles: list,
                 party_id,
                 mailing_addr,
                 delivery_addr):
    """Create party object with custom roles, mailing addresses and delivery aadresses."""
    party = {
        'officer': {
            'id': party_id,
            'firstName': 'Joe',
            'lastName': 'Swanson',
            'middleName': 'P',
            'email': 'joe@email.com',
            'organizationName': '',
            'partyType': 'person'
        },
        'mailingAddress': None,
        'deliveryAddress': None,
        'roles': []
    }

    for role in roles:
        party['roles'].append({
            'roleType': role,
            'appointmentDate': '2018-01-01'
        })

    if mailing_addr:
        party['mailingAddress'] = mailing_addr

    if mailing_addr:
        party['deliveryAddress'] = delivery_addr

    return party