':param Participant participant: the participant to get the take for
:param GratipayDB cursor: a database cursor; if ``None``, a new cursor
will be used
:return: a :py:class:`~decimal.Decimal`: the ``participant``\'s take
from this team at the beginning of the last completed payday, or 0.'

def get_take_last_week_for(self, participant, cursor=None):

    return (cursor or self.db).one(u'\n\n                                                SELECT    amount\n                                                        FROM    takes\n                                                    WHERE    team_id=%s    AND    participant_id=%s\n                                                            AND    mtime    <    (\n                                                                                            SELECT    ts_start\n                                                                                                    FROM    paydays\n                                                                                                WHERE    ts_end    >    ts_start\n                                                                                    ORDER    BY    ts_start    DESC    LIMIT    1\n                                                                            )\n                                        ORDER    BY    mtime    DESC    LIMIT    1\n\n                                ', (self.id, participant.id), default=ZERO)
