If you are working on a game. I suggest you use Pygame. I assume you are talking about collision checking for the use of sprite rectangles? Anyway here's an algorithm to check for collision between two rectangles. I am not writing a function for you to copy paste and use it in your program. This is just logic for you to understand and for you to write a piece of code by yourself to write from this logic depending on your application.
def check_collision( A, B )
{
#If any of the sides from A are outside of B
if( bottomA <= topB )
{
return false;
}
if( topA >= bottomB )
{
return false;
}
if( rightA <= leftB )
{
return false;
}
if( leftA >= rightB )
{
return false;
}
#If none of the sides from A are outside B
return true;
}