<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def str2tuple(str_in):
    '''
    Extracts a tuple from a string.

    Args:
        str_in (string) that contains python tuple
    Returns:
        (dict) or None if no valid tuple was found
    Raises:
        -
    '''
    tuple_out = safe_eval(str_in)
    if not isinstance(tuple_out, tuple):
        tuple_out = None
    return tuple_out