def sid(s):
    """Ensure s is a valid UC Berkeley SID"""
    student_sid = s.strip()
    if len(student_sid) != 8:
        raise ValueError('SID must be 8 digits long')
    for digit in student_sid:
        if digit not in '0123456789':
            raise ValueError('Non-numeric digit in SID: %s' % digit)
    else:
        return student_sid
