def get_owned_replicasets(deployment, replicasets) ->list:
    """Return all replicasets owned by a deployment"""
    owned = []
    for rs in replicasets:
        for owner in rs['metadata'].get('ownerReferences', []):
            if owner['uid'] == deployment['metadata']['uid']:
                owned.append(rs)
    return owned
