<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_k(self,k,vals):
 """ parse the iterable from a property or boundary condition argument Parameters k : int or iterable int the iterable vals : iterable of ints the acceptable values that k may contain Returns ------- k_vals : iterable of int parsed k values """

        try:
            k = int(k)
        except:
            pass
        else:
            assert k in vals,"k {0} not in vals".format(k)
            return [k]
        if k is None:
            return vals
        else:
            try:
                k_vals = vals[k]
            except Exception as e:
                raise Exception("error slicing vals with {0}:{1}".
                                format(k,str(e)))
            return k_vals