'Get the person record ID for the current logged-in user'

def s3_logged_in_person(self):

    row = None
    if self.s3_logged_in():
        ptable = current.s3db.pr_person
        try:
            query = (ptable.pe_id == self.user.pe_id)
        except AttributeError:
            pass
        else:
            row = current.db(query).select(ptable.id, limitby=(0, 1)).first()
    return (row.id if row else None)
