any code examples for pairs finding

Hi everyone,

are there any examples floating around of code to do co-integration tests?

I've seen some examples of pairs trading but what i'm interested in is, for example, if you have prices as

price_df


and a function, say,

find_co_in(price_df, sid(3766)) #ibm


and it returns
sid(46631) #goog
sid(24) #aapl
or something similar.