<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_pin(name_str):
 """Parses a string and returns a pin-num."""

    if len(name_str) < 1:
        raise ValueError("Expecting pin name to be at least 4 charcters.")
    if name_str[0] != 'P':
        raise ValueError("Expecting pin name to start with P")
    pin_str = name_str[1:].split('/')[0]
    if not pin_str.isdigit():
        raise ValueError("Expecting numeric pin number.")
    return int(pin_str)